Jana Nguyen
2018-09-06 21:30:17 UTC
I am trying to retrieve the key bytes of a wrapped key. We are using IAIK
with SoftHSM 2.4.0.
When I unwrap the key, the key object returned but when we get the key
bytes, I get null.
Key template has been initialized with âsensitive=falseâ and below code
works find with the Thales HSM appliance, but not with SoftHSM.
long CKM_AES_KEY_WRAP = 0x00002109L;
Mechanism wrappingMechanism = new Mechanism(CKM_AES_KEY_WRAP);
InitializationVectorParameters ivParam = new
InitializationVectorParameters(iv);
wrappingMechanism.setParameters(ivParam);
AESSecretKey key = session.unwrapKey(wrappingMechanism,
keyEncryptionKey, wrappedKey, keyTemplate);
byte[] plaintextkey = key.getValue().getByteArrayValue();
Error I'm getting:
(plaintextkey is null)
Any ideas or workaround to get this to work? Any input is much appreciated.
with SoftHSM 2.4.0.
When I unwrap the key, the key object returned but when we get the key
bytes, I get null.
Key template has been initialized with âsensitive=falseâ and below code
works find with the Thales HSM appliance, but not with SoftHSM.
long CKM_AES_KEY_WRAP = 0x00002109L;
Mechanism wrappingMechanism = new Mechanism(CKM_AES_KEY_WRAP);
InitializationVectorParameters ivParam = new
InitializationVectorParameters(iv);
wrappingMechanism.setParameters(ivParam);
AESSecretKey key = session.unwrapKey(wrappingMechanism,
keyEncryptionKey, wrappedKey, keyTemplate);
byte[] plaintextkey = key.getValue().getByteArrayValue();
Error I'm getting:
(plaintextkey is null)
Any ideas or workaround to get this to work? Any input is much appreciated.