Reputation: 95
static Module pkcs11Module = Module.getInstance(@"C:\Program Files (x86)\SafeNet\Protect Toolkit 5\Protect Toolkit C SDK\bin\sw\cryptoki.dll");
public HsmManager()
{
try
{
pkcs11Module.initialize(null);
Slot[] terminals = pkcs11Module.getSlotList(true);
Slot s;
Token token = terminals[0].Token;
Session session = token.openSession(false, false, null, null);
char[] pass = new char[] { '1', '2', '3', '4' };
session.login(true, pass);}}
I do the sealing process with the hsm device in c # with the pkcs11 library (without using any other library). The error message is Message ="CKR_USER_PIN_NOT_INITIALIZED " What's wrong? Thanks
Upvotes: 2
Views: 2998
Reputation: 774
I don't know nothing about cryptoki, but I'll try to answer:
Take a look at PKCS#11 standard.
CKR_USER_PIN_NOT_INITIALIZED: This value can only be returned by C_Login. It indicates that the normal user’s PIN has not yet been initialized with C_InitPIN.
In other words, your token has no PIN.
Try to initialize the PIN or try sending a null PIN in login call (maybe "there is some way for a user to be authenticated to the token without having the application send a PIN through the Cryptoki library")
Upvotes: 1