python-pkcs11
python-pkcs11 copied to clipboard
Unable to generate key with Attribute.SENSITIVE False
I am following the documentation to generate an exportable AES key, but when I use the below code snippet, I get the subsequent error stack.
I am using a Luna password-based HSM but am not sure of the version. Any help would be appreciated!
from pkcs11 import KeyType, Attribute
key = session.generate_key(KeyType.AES, 256, template={
Attribute.SENSITIVE: False,
Attribute.EXTRACTABLE: True,
})
print(key[Attribute.VALUE])
Traceback (most recent call last):
File "create_key.py", line 33, in <module>
key = session.generate_key(pkcs11.KeyType.AES, 256, store=False, label=args.keylabel, template={
File "pkcs11/_pkcs11.pyx", line 488, in pkcs11._pkcs11.Session.generate_key
File "pkcs11/_errors.pyx", line 88, in pkcs11._pkcs11.assertRV
pkcs11.exceptions.AttributeValueInvalid
We are also facing same issue, we cannot unwarp a key to get the key value. Cannot set the attribute sensitive as false.