Use bits instead of bytes for a private/public key

This commit is contained in:
Martin Willi
2010-08-10 18:46:30 +02:00
parent 33ddaaabec
commit a944d2092b
24 changed files with 71 additions and 53 deletions
@@ -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,