<link>http://ncryptoki.com/forum.aspx</link> <description /> <docs>http://www.rssboard.org/rss-specification</docs> <generator>mojoPortal Forum module</generator> <item> <title>Re: Storing AES Key You are using a 32bit version of NCryptoki in your VS2012 64bit application.

If you compile your app for AnyCPU it runs as 64bit application and cannot load a 32bit dll.

you can either:

1) Change your target cpu to x86 and use the 32bit version of the underlyin PKCS#11 dll

or

2) use the 64bit version of NCryptoki. you will find it in the sdk folder

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=94~-1#post449 Miked982 http://ncryptoki.com/Forums/Thread.aspx?pageid= Wed, 27 Feb 2013 13:30:35 GMT Re: Storing AES Key I have been told to move development environment - now using Windows Server 2012 with Visual Studios 2012 and I get stuck on this

 

Cryptoki cryptoki = new Cryptoki("C:\\Program Files (x86)\\nCipher\\nfast\\toolkits\\pkcs11\\cknfast-64.dll");
 

It fails with error code 193 SIGNATURE_LEN_RANGE, would you suspect this is an error with the cknfast-64.dll?

 

Cheers

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=94~-1#post448 Miked982 http://ncryptoki.com/Forums/Thread.aspx?pageid= Wed, 27 Feb 2013 12:37:24 GMT
Re: Storing AES Key Thanks for that it worked.

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=94~-1#post445 Miked982 http://ncryptoki.com/Forums/Thread.aspx?pageid= Fri, 22 Feb 2013 13:44:55 GMT
Re: Storing AES Key Hi,

to store the key in the HSM you should set the CKA_TOKEN attribute to true:

template.Add(new ObjectAttribute(ObjectAttribute.CKA_TOKEN, true));

 

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=94~-1#post444 Miked982 http://ncryptoki.com/Forums/Thread.aspx?pageid= Fri, 22 Feb 2013 09:17:31 GMT
Storing AES Key Hello,

I am able to create an AES secrect key on our HSM using:

 

 // Template to create an AES256
CryptokiCollection template = new CryptokiCollection();
template.Add(new ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_SECRET_KEY));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_KEY_TYPE, Key.CKK_AES));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_ID, "666"));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, "SecretKey"));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_PRIVATE, false));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_ENCRYPT, true));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_DECRYPT, true));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_SENSITIVE, false));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_WRAP, false));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_VALUE_LEN, 32));
Key secretKey = session.GenerateKey(Mechanism.AES_KEY_GEN, template);

 

but I can't see how to make the key persist in order to back it up - is this a user or session problem or is the a specific Attribute I am missing.

 

Cheers,

Mike
 

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=94~-1#post443 Miked982 http://ncryptoki.com/Forums/Thread.aspx?pageid= Thu, 21 Feb 2013 09:09:27 GMT