sign: API changes for public keys and CLI keys format

API changes:
- added function `ostree_sign_add_pk()` for multiple public keys using.
- `ostree_sign_set_pk()` now substitutes all previously added keys.
- added function `ostree_sign_load_pk()` allowed to load keys from file.
- `ostree_sign_ed25519_load_pk()` able to load the raw keys list from file.
- use base64 encoded public and private ed25519 keys for CLI and keys file.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
This commit is contained in:
Denis Pynkin committed 2020-03-25 15:23:54 +03:00
1 parent 9e8f0f4ca0
commit 2303202c86
11 files changed
+278 -53

No files matched your search

+12 -5
View File
@@ -1508,13 +1508,21 @@ ostree_verify_unwritten_commit (OtPullData *pull_data,
gboolean ret = FALSE;
g_autoptr(GBytes) signed_data = g_variant_get_data_as_bytes (commit);
/* list all signature types in detached metadata and check if signed by any? */
GStrv names = ostree_sign_list_names();
g_auto(GStrv) names = ostree_sign_list_names();
for (guint i=0; i < g_strv_length (names); i++)
{
g_autoptr (OstreeSign) sign = ostree_sign_get_by_name (names[i], error);
g_autoptr (OstreeSign) sign = NULL;
g_autoptr(GVariant) signatures = NULL;
g_autofree gchar *signature_key = ostree_sign_metadata_key (sign);
g_autofree GVariantType *signature_format = (GVariantType *) ostree_sign_metadata_format (sign);
g_autofree gchar *signature_key = NULL;
g_autofree GVariantType *signature_format = NULL;
if ((sign = ostree_sign_get_by_name (names[i], error)) == NULL)
{
g_error_free (*error);
continue;
}
signature_key = ostree_sign_metadata_key (sign);
signature_format = (GVariantType *) ostree_sign_metadata_format (sign);
signatures = g_variant_lookup_value (detached_metadata,
signature_key,
@@ -1531,7 +1539,6 @@ ostree_verify_unwritten_commit (OtPullData *pull_data,
))
ret = TRUE;
}
g_strfreev(names);
return ret;
}