lib: Add an API to GPG verify a commit given a remote

Conceptually we've been moving towards having our GPG verification
paths be per-remote.  The code internally supports this, but we
didn't expose an API to use it conveniently.

This came up when trying to add a new `gpgkeypath` option, since
right now rpm-ostree manually finds keyrings for the remote, and
hence it wasn't looking at the keypath, and said "Unknown key"
in status.

Adding an API fixes this nicely.

Closes: #576
Approved by: giuseppe
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-11-17 11:33:41 +00:00
1 parent f244c70277
commit 24bf257ee9
6 files changed
+64 -5

No files matched your search

+10 -2
View File
@@ -364,9 +364,17 @@ global:
* NOTE NOTE NOTE
*/
LIBOSTREE_2016.14 {
global:
ostree_repo_verify_commit_for_remote;
} LIBOSTREE_2016.8;
/* Section for the stable release *after* this development one; don't
* edit this other than to update the last number. */
/* Remove comment when first new symbol is added, replace XX with new stable version.
LIBOSTREE_2016.XX
LIBOSTREE_2016.XX {
global:
someostree_symbol_deleteme;
} LIBOSTREE_2016.8;
} LIBOSTREE_2016.14;
* Remove comment when first new symbol is added */
+30
View File
@@ -4509,6 +4509,36 @@ ostree_repo_verify_commit_ext (OstreeRepo *self,
error);
}
/**
* ostree_repo_verify_commit_for_remote:
* @self: Repository
* @commit_checksum: ASCII SHA256 checksum
* @remote: OSTree remote to use for configuration
* @cancellable: Cancellable
* @error: Error
*
* Read GPG signature(s) on the commit named by the ASCII checksum
* @commit_checksum and return detailed results, based on the keyring
* configured for @remote.
*
* Returns: (transfer full): an #OstreeGpgVerifyResult, or %NULL on error
*/
OstreeGpgVerifyResult *
ostree_repo_verify_commit_for_remote (OstreeRepo *self,
const gchar *commit_checksum,
const gchar *remote_name,
GCancellable *cancellable,
GError **error)
{
return _ostree_repo_verify_commit_internal (self,
commit_checksum,
remote_name,
NULL,
NULL,
cancellable,
error);
}
/**
* ostree_repo_gpg_verify_data:
* @self: Repository
+8
View File
@@ -1064,6 +1064,14 @@ OstreeGpgVerifyResult * ostree_repo_verify_commit_ext (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
OstreeGpgVerifyResult *
ostree_repo_verify_commit_for_remote (OstreeRepo *self,
const gchar *commit_checksum,
const gchar *remote_name,
GCancellable *cancellable,
GError **error);
_OSTREE_PUBLIC
OstreeGpgVerifyResult * ostree_repo_gpg_verify_data (OstreeRepo *self,
const gchar *remote_name,