diff options
author | Martin Willi <martin@revosec.ch> | 2010-08-10 15:56:10 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2010-08-10 18:46:30 +0200 |
commit | a944d2092bb8663be21f863bbe27fa475966c9d9 (patch) | |
tree | 7a3d6f2c612f7e9e229c0e8be2fa21fb05d3db2e /src/libstrongswan/plugins/openssl/openssl_ec_private_key.c | |
parent | 33ddaaabec136e358bf38a6aeb7855f466603007 (diff) | |
download | strongswan-a944d2092bb8663be21f863bbe27fa475966c9d9.tar.bz2 strongswan-a944d2092bb8663be21f863bbe27fa475966c9d9.tar.xz |
Use bits instead of bytes for a private/public key
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_ec_private_key.c')
-rw-r--r-- | src/libstrongswan/plugins/openssl/openssl_ec_private_key.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c index ffd9ac62e..15b0f577b 100644 --- a/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c +++ b/src/libstrongswan/plugins/openssl/openssl_ec_private_key.c @@ -178,10 +178,20 @@ METHOD(private_key_t, decrypt, bool, return FALSE; } -METHOD(private_key_t, get_keysize, size_t, +METHOD(private_key_t, get_keysize, int, private_openssl_ec_private_key_t *this) { - return EC_FIELD_ELEMENT_LEN(EC_KEY_get0_group(this->ec)); + switch (EC_GROUP_get_curve_name(EC_KEY_get0_group(this->ec))) + { + case NID_X9_62_prime256v1: + return 256; + case NID_secp384r1: + return 384; + case NID_secp521r1: + return 521; + default: + return 0; + } } METHOD(private_key_t, get_type, key_type_t, |