diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-09-06 11:59:11 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-09-06 12:44:35 +0200 |
commit | 2a693e1d3d7a7c6e4a14ecea664d0cc86f12216b (patch) | |
tree | 10dbafcd2af384ce065c275fa6b4120600c5373e /lib/pkcs11_int.h | |
parent | 08de2069506b3c1e69e1fbdfe772ae5329c64c53 (diff) | |
download | gnutls-2a693e1d3d7a7c6e4a14ecea664d0cc86f12216b.tar.gz |
Added support to read elliptic curve public keys from PKCS #11 tokens (untested).
Diffstat (limited to 'lib/pkcs11_int.h')
-rw-r--r-- | lib/pkcs11_int.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/pkcs11_int.h b/lib/pkcs11_int.h index 2a8fc8bf80..2480da7769 100644 --- a/lib/pkcs11_int.h +++ b/lib/pkcs11_int.h @@ -106,6 +106,17 @@ static inline int pk_to_mech(gnutls_pk_algorithm_t pk) return CKM_RSA_PKCS; } +static inline gnutls_pk_algorithm_t mech_to_pk(ck_key_type_t m) +{ + if (m == CKK_RSA) + return GNUTLS_PK_RSA; + else if (m == CKK_DSA) + return GNUTLS_PK_DSA; + else if (m == CKK_ECDSA) + return GNUTLS_PK_ECC; + else return GNUTLS_PK_UNKNOWN; +} + static inline int pk_to_genmech(gnutls_pk_algorithm_t pk) { if (pk == GNUTLS_PK_DSA) |