From 2141b7112d237221280781bed2b2bb6efadc963e Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 20 Oct 2011 20:39:28 +0200 Subject: add key algo to import msg Signed-off-by: Florian Pritz Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 1 + lib/libalpm/signing.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'lib/libalpm') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index f25d4c44..1751c81c 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -228,6 +228,7 @@ typedef struct _alpm_pgpkey_t { alpm_time_t expires; unsigned int length; unsigned int revoked; + char pubkey_algo; } alpm_pgpkey_t; /** Signature result. Contains the key, status, and validity of a given diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index dbdd350b..0bef4451 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -272,6 +272,26 @@ static int key_search(alpm_handle_t *handle, const char *fpr, pgpkey->expires = key->subkeys->expires; pgpkey->length = key->subkeys->length; pgpkey->revoked = key->subkeys->revoked; + + switch (key->subkeys->pubkey_algo) { + case GPGME_PK_RSA: + case GPGME_PK_RSA_E: + case GPGME_PK_RSA_S: + pgpkey->pubkey_algo = 'R'; + break; + + case GPGME_PK_DSA: + pgpkey->pubkey_algo = 'D'; + break; + + case GPGME_PK_ELG_E: + case GPGME_PK_ELG: + case GPGME_PK_ECDSA: + case GPGME_PK_ECDH: + pgpkey->pubkey_algo = 'E'; + break; + } + ret = 1; error: -- cgit v1.2.3-70-g09d2