repo: Add ostree_repo_verify_summary()
Verifies signatures on a summary -- both taken as GBytes inputs -- and returns an OstreeGpgVerifyResult.
This commit is contained in:
parent
403e05af24
commit
1df16a7675
|
|
@ -313,6 +313,7 @@ ostree_repo_sign_commit
|
||||||
ostree_repo_append_gpg_signature
|
ostree_repo_append_gpg_signature
|
||||||
ostree_repo_verify_commit
|
ostree_repo_verify_commit
|
||||||
ostree_repo_verify_commit_ext
|
ostree_repo_verify_commit_ext
|
||||||
|
ostree_repo_verify_summary
|
||||||
ostree_repo_regenerate_summary
|
ostree_repo_regenerate_summary
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
OSTREE_REPO
|
OSTREE_REPO
|
||||||
|
|
|
||||||
|
|
@ -1879,15 +1879,11 @@ ostree_repo_remote_fetch_summary (OstreeRepo *self,
|
||||||
if (gpg_verify_summary && summary != NULL && signatures != NULL)
|
if (gpg_verify_summary && summary != NULL && signatures != NULL)
|
||||||
{
|
{
|
||||||
glnx_unref_object OstreeGpgVerifyResult *result = NULL;
|
glnx_unref_object OstreeGpgVerifyResult *result = NULL;
|
||||||
g_autoptr(GVariant) signatures_variant = NULL;
|
|
||||||
|
|
||||||
signatures_variant = g_variant_new_from_bytes (OSTREE_SUMMARY_SIG_GVARIANT_FORMAT,
|
result = ostree_repo_verify_summary (self,
|
||||||
signatures, FALSE);
|
|
||||||
result = _ostree_repo_gpg_verify_with_metadata (self,
|
|
||||||
summary,
|
|
||||||
signatures_variant,
|
|
||||||
name,
|
name,
|
||||||
NULL, NULL,
|
summary,
|
||||||
|
signatures,
|
||||||
cancellable,
|
cancellable,
|
||||||
error);
|
error);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
@ -4489,6 +4485,47 @@ ostree_repo_verify_commit_ext (OstreeRepo *self,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_repo_verify_summary:
|
||||||
|
* @self: Repo
|
||||||
|
* @remote_name: Name of remote
|
||||||
|
* @summary: Summary data as a #GBytes
|
||||||
|
* @signatures: Summary signatures as a #GBytes
|
||||||
|
* @cancellable: Cancellable
|
||||||
|
* @error: Error
|
||||||
|
*
|
||||||
|
* Verify @signatures for @summary data using GPG keys in the keyring for
|
||||||
|
* @remote_name, and return an #OstreeGpgVerifyResult.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): an #OstreeGpgVerifyResult, or %NULL on error
|
||||||
|
*/
|
||||||
|
OstreeGpgVerifyResult *
|
||||||
|
ostree_repo_verify_summary (OstreeRepo *self,
|
||||||
|
const char *remote_name,
|
||||||
|
GBytes *summary,
|
||||||
|
GBytes *signatures,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
g_autoptr(GVariant) signatures_variant = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (OSTREE_IS_REPO (self), NULL);
|
||||||
|
g_return_val_if_fail (remote_name != NULL, NULL);
|
||||||
|
g_return_val_if_fail (summary != NULL, NULL);
|
||||||
|
g_return_val_if_fail (signatures != NULL, NULL);
|
||||||
|
|
||||||
|
signatures_variant = g_variant_new_from_bytes (OSTREE_SUMMARY_SIG_GVARIANT_FORMAT,
|
||||||
|
signatures, FALSE);
|
||||||
|
|
||||||
|
return _ostree_repo_gpg_verify_with_metadata (self,
|
||||||
|
summary,
|
||||||
|
signatures_variant,
|
||||||
|
remote_name,
|
||||||
|
NULL, NULL,
|
||||||
|
cancellable,
|
||||||
|
error);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ostree_repo_regenerate_summary:
|
* ostree_repo_regenerate_summary:
|
||||||
* @self: Repo
|
* @self: Repo
|
||||||
|
|
|
||||||
|
|
@ -782,6 +782,13 @@ OstreeGpgVerifyResult * ostree_repo_verify_commit_ext (OstreeRepo *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
OstreeGpgVerifyResult * ostree_repo_verify_summary (OstreeRepo *self,
|
||||||
|
const char *remote_name,
|
||||||
|
GBytes *summary,
|
||||||
|
GBytes *signatures,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
gboolean ostree_repo_regenerate_summary (OstreeRepo *self,
|
gboolean ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||||
GVariant *additional_metadata,
|
GVariant *additional_metadata,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue