diff options
author | Timo Schulz <twoaday@gnutls.org> | 2002-03-26 17:35:22 +0000 |
---|---|---|
committer | Timo Schulz <twoaday@gnutls.org> | 2002-03-26 17:35:22 +0000 |
commit | 5dbbfc9710578e4e3a6c2767b57c25307fe2fcc9 (patch) | |
tree | 1e4eb81ef8fdee54f06385918396a78e3e118ee2 | |
parent | 3df4b5e02fef796bd978de4d54cea3b6ba7c5afd (diff) | |
download | gnutls-5dbbfc9710578e4e3a6c2767b57c25307fe2fcc9.tar.gz |
Now the pk algorithm is returned and not only the key size in bits.
-rw-r--r-- | lib/gnutls_openpgp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gnutls_openpgp.c b/lib/gnutls_openpgp.c index fbeb233bc1..89d6e62f5d 100644 --- a/lib/gnutls_openpgp.c +++ b/lib/gnutls_openpgp.c @@ -972,6 +972,7 @@ int gnutls_openpgp_extract_key_pk_algorithm(const gnutls_datum *cert, int *r_bits) { KBNODE kb_pk = NULL, pkt; + int algo = 0; if ( !cert || !r_bits ) return GNUTLS_E_INVALID_PARAMETERS; @@ -981,9 +982,16 @@ gnutls_openpgp_extract_key_pk_algorithm(const gnutls_datum *cert, int *r_bits) pkt = cdk_kbnode_find( kb_pk, PKT_PUBLIC_KEY ); if ( pkt ) *r_bits = cdk_pk_get_nbits( pkt->pkt->pkt.public_key ); + algo = pkt->pkt->pkt.public_key->pubkey_algo; + if ( is_RSA( algo ) ) + algo = GNUTLS_PK_RSA; + else if ( is_DSA( algo ) ) + algo = GNUTLS_PK_DSA; + else + algo = GNUTLS_PK_UNKNOWN; cdk_kbnode_release( kb_pk ); - return 0; + return algo; } |