Dear Ugo,
I am using this code to derive a session key but it is throwing an exception error. 96
The mechanisim used is:SHA1_KEY_DERIVATION
Root Key is a private RSA key of size 1024
//Search for the specific key CryptokiCollection templatePub = new CryptokiCollection(); templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, KeyBaseLabel)); CryptokiObject RootKey = session.Objects.Find(templatePub);
//Set the session key label CryptokiCollection Sessiontemplate = new CryptokiCollection(); Sessiontemplate.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, NewSessionKeyLabel)); Key _sessionKey = session.DeriveKey(_mech, (Key)RootKey, Sessiontemplate);
I think you should read carefully the PKCS#11specifications.
you cannot derive a key from an RSA private key.
Error 96 is: CKR_KEY_HANDLE_INVALID
Please read pag. 314 of PKCS#11 v2.20 specifications that you can find in our wiki.
I'm using VB6 with Ncryptoki and I can't find any example about key derivation.
I have a HSM with a doubleDes master key and I need to derivate that key.
Do you have any example?
Thank you very much for your help
Best regards!
Fernando
Hi to all
Anybody can help me with this ?
Thanks in advance!