summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pkcs11_write.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/pkcs11_write.c b/lib/pkcs11_write.c
index 34ff41c004..9630675a5b 100644
--- a/lib/pkcs11_write.c
+++ b/lib/pkcs11_write.c
@@ -282,6 +282,8 @@ gnutls_pkcs11_copy_x509_privkey(const char *token_url,
return ret;
}
+ pk = gnutls_x509_privkey_get_pk_algorithm(key);
+
/* FIXME: copy key usage flags */
a_val = 0;
a[a_val].type = CKA_CLASS;
@@ -294,6 +296,18 @@ gnutls_pkcs11_copy_x509_privkey(const char *token_url,
a[a_val].value_len = id_size;
a_val++;
+ a[a_val].type = CKA_SIGN;
+ a[a_val].value = (void*)&tval;
+ a[a_val].value_len = sizeof(tval);
+ a_val++;
+
+ if (pk == GNUTLS_PK_RSA) {
+ a[a_val].type = CKA_DECRYPT;
+ a[a_val].value = (void*)&tval;
+ a[a_val].value_len = sizeof(tval);
+ a_val++;
+ }
+
a[a_val].type = CKA_KEY_TYPE;
a[a_val].value = &type;
a[a_val].value_len = sizeof(type);
@@ -338,7 +352,6 @@ gnutls_pkcs11_copy_x509_privkey(const char *token_url,
a_val++;
}
- pk = gnutls_x509_privkey_get_pk_algorithm(key);
switch (pk) {
case GNUTLS_PK_RSA:
{