struct gnutls_pkcs11_privkey_st {
gnutls_pk_algorithm_t pk_algorithm;
unsigned int rsa_pss_ok; /* if it is an RSA key, it can do RSA-PSS */
+ unsigned int bits;
unsigned int flags;
struct p11_kit_uri *uinfo;
unsigned int *bits)
{
if (bits)
- *bits = 0; /* FIXME */
+ *bits = key->bits;
return key->pk_algorithm;
}
a[0].type = CKA_KEY_TYPE;
a[0].value = &key_type;
a[0].value_len = sizeof(key_type);
-
if (pkcs11_get_attribute_value(pkey->sinfo.module, pkey->sinfo.pks, pkey->ref, a, 1)
== CKR_OK) {
pkey->pk_algorithm = key_type_to_pk(key_type);
goto cleanup;
}
+
if (pkey->pk_algorithm == GNUTLS_PK_RSA) { /* determine whether it can do rsa-pss */
+ a[0].type = CKA_MODULUS;
+ a[0].value = NULL;
+ a[0].value_len = 0;
+ if (pkcs11_get_attribute_value(pkey->sinfo.module, pkey->sinfo.pks, pkey->ref, a, 1)
+ == CKR_OK) {
+ pkey->bits = a[0].value_len*8;
+ }
+
ret = gnutls_pkcs11_token_check_mechanism(url, CKM_RSA_PKCS_PSS, NULL, 0, 0);
if (ret != 0)
pkey->rsa_pss_ok = 1;