From: Michael Tremer Date: Wed, 12 Oct 2022 10:09:39 +0000 (+0000) Subject: repo: Store the fingerprint of the imported key X-Git-Tag: 0.9.28~250 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=749f8969388b64a0d73a248f2a782675a6d11bcc;p=pakfire.git repo: Store the fingerprint of the imported key Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/include/pakfire/key.h b/src/libpakfire/include/pakfire/key.h index 4962a22c7..139bc63ca 100644 --- a/src/libpakfire/include/pakfire/key.h +++ b/src/libpakfire/include/pakfire/key.h @@ -67,6 +67,8 @@ char* pakfire_key_dump(struct pakfire_key* key); #include +#define PAKFIRE_KEY_FPR_MAXLEN 41 + int pakfire_key_create(struct pakfire_key** key, struct pakfire* pakfire, gpgme_key_t gpgkey); int pakfire_key_sign(struct pakfire_key* key, const char* buffer, const size_t buffer_length, diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index 9f4f92211..38ab62401 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -63,7 +63,7 @@ struct pakfire_repo_appdata { char metadata[PATH_MAX]; // Key fingerprint - char* key; + char key[PAKFIRE_KEY_FPR_MAXLEN]; // Mirrorlist char* mirrorlist_url; @@ -153,6 +153,18 @@ static int pakfire_repo_import_key(struct pakfire_repo* repo, FILE* f) { if (dump) DEBUG(repo->pakfire, "Imported key:\n%s\n", dump); + + // Fetch the key's fingerprint + const char* fingerprint = pakfire_key_get_fingerprint(*key); + if (!fingerprint) { + r = 1; + goto ERROR; + } + + // Store the fingerprint + r = pakfire_string_set(repo->appdata->key, fingerprint); + if (r) + goto ERROR; } ERROR: