Search generates no results

3/20/2012 2:09:06 PM
Gravatar
Total Posts 6

Search generates no results

Hi

 

I'm trying to retrieve an RSA Private Key from a ncipher net hsm 2000, but for some I can't find the keys.
I know there is a key on the particular slot I'm connected to - but I can't retrieve it.

The code below is based on the sample code from the wiki.
Any ideas what I might be doing wrong?
Is there a way to list all "objects" stored in that slot (e.g. to see whats really there)?

Best regards,
Mikael
 

CryptokiCollection template = new CryptokiCollection();
template = new CryptokiCollection();
template.Add(new ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_PRIVATE_KEY));
template.Add(new ObjectAttribute(ObjectAttribute.CKA_KEY_TYPE, Key.CKK_RSA));
//template.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, "SigningKey_SYD_TEST_HSM_20120314_111500"));

CryptokiCollection objects = session.Objects.Find(template, 1);  //generates 0 results
 

3/20/2012 2:20:42 PM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Search generates no results

the key you are searching for is private. Did you make the Login?
3/20/2012 2:24:17 PM
Gravatar
Total Posts 6

Re: Search generates no results

Hi Ugo

 

Thanks for a fast reply :)

Yes, the login was successfull (returned 0):
 int nRes = session.Login(Session.CKU_USER, pin);   


Is the problem perhaps that I logged in as user instead of... well, the other alternatives ;)

 

Regards,
Mikael