JCryptoki and session.login with cryptoki

7/18/2014 11:52:54 AM
Gravatar
Total Posts 2

JCryptoki and session.login with cryptoki

I try to connecting using cryptoki.dll (SafeNET) All looks good util use session.login

 

     int nRes = session.login(Session.CKU_SO, "1111");
            if (nRes != 0) {
               // System.out.println("Wrong PIN");
               // return true;
            }

I get nRes = 160 (wrong pin) I also try it using CKU_USER, but when I connect to the same library cryptoki.dll with other tools it's OK

It's very important to me today, because we must get decision today about buying this library

7/18/2014 3:11:54 PM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: JCryptoki and session.login with cryptoki

if you read PKCS#11 specification, CKU_USER is for the user PIN while CKU_SO is for the PUK or Administration PIN.
if you send the wrong PIN code you get error 160 (wrong PIN).

Probably the PIN is not 4 digits long (1111) but it may have some padding digits that the other tools hide to you. Also, following PKCS#11 specs the PIN is a byte array (byte[]) this means that it may not necessarily be digits but also characters or binary values such as 0xFF.