Session Key Derivation

11/30/2012 10:35:28 AM
Gravatar
Total Posts 13

Session Key Derivation

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);

 

11/30/2012 11:04:27 AM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Session Key Derivation

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.

 

2/1/2013 4:14:48 PM
Gravatar
Total Posts 5

Re: Session Key Derivation

Dear Ugo,

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

 

2/13/2013 2:56:20 PM
Gravatar
Total Posts 5

Re: Session Key Derivation

Hi to all

Anybody can help me with this ?

Thanks in advance!