How To Modify PKCS11 Object Value Attribute

74 Views Asked by At

I have a Nitrokey HSM 2 which I am using python-pkcs11 to interface with via a Python3 program. I have an object of class type pkcs11.ObjectClass.DATA on the HSM whose Attribute.VALUE I would like to update often since I am using it as a sort of data storage.

So far, the only way I can find to do this is by deleting the object entirely and re-creating it, but this adds too much overhead since this causes the operations to run for 10x longer.

What is a better way to do this?

1

There are 1 best solutions below

2
On

This is inpossible due to limitations in the implementation of PKCS#11 library.
Check the source code line:

error!("C_SetAttributeValue() is supported only on CKA_ID");

The only way you can do is to re-create the DATA object with new Value content.