Hi
I'm trying to generate a key pair and store them on the token (ncipher net hsm 2000).
I'm getting error code 209: CKR_TEMPLATE_INCONSISTENT, and I can't figure out what's missing.
See the code snippet below where the attributes are defined.
Any ideas anyone?
Regards,
Mikael
........
Log("Adding public attributes", true);
CryptokiCollection templatePub = new CryptokiCollection();
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_PUBLIC_KEY));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_DERIVE, false));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_ENCRYPT, true));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_KEY_TYPE, Key.CKK_RSA));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_TOKEN, storeOnToken));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_PRIVATE, true));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, publicLabel));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_ID, "1"));
templatePub.Add(new ObjectAttribute(ObjectAttribute.CKA_MODULUS_BITS, 1024));
Log("Added " + templatePub.Count.ToString() + " attributes.", true);
Log("Adding private attributes", true);
CryptokiCollection templatePri = new CryptokiCollection();
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_PRIVATE_KEY));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_DECRYPT, true));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_DERIVE, false));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_EXTRACTABLE, true));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_KEY_TYPE, Key.CKK_RSA));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_TOKEN, storeOnToken));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_PRIVATE, true));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, privateLabel));
templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_ID, "1"));
//templatePri.Add(new ObjectAttribute(ObjectAttribute.CKA_MODULUS_BITS, 1024));
Log("Added " + templatePri.Count.ToString() + " attributes.", true);
............