Problem with the key length Lc on UNWRAP ADPU?

Hello, on a Nitrokey HSM I am trying the WRAP and UNWRAP APDU commands.

But the length of my wrapped key takes more than one byte… On two tries, I do have “3CB” and “16B”.

How can we specify the length of the length ? Or make sure on the WRAP that the length of the length of the key that not exceed one byte ?


I think this is defined in the ISO7816 interface standard - please check there.
You can also peek the communication done by OpenSC tools, e.g.:

env OPENSC_DEBUG=9 sc-hsm-tool --wrap-key wrap-key-1.bin --key-reference 20 --pin 123456


OK I will try with the "sc-hsm-tool’.

With the APDU command, I received a
“Key meta data and key value encrypted under the Key Encryption Key”
but its global length is way more that 256 bits…

Hello szszszsz,

it works with the sc-hsm-tool. I will check with the OPENSC_DEBUG=9 to understand the differences.

Thank you.

1 Like