CKR_USER_NOT_LOGGED_IN error

10/25/2016 1:45:48 PM
Gravatar
Total Posts 1

CKR_USER_NOT_LOGGED_IN error

Hi,

I am contacting you from <span data-scayt_word="F3M" data-scaytid="3">F3M - Information Systems S.A., a company from <span data-scayt_word="Braga" data-scaytid="4">Braga (Portugal) and we’re trying to interact with a <span data-scayt_word="smartcard" data-scaytid="5">smartcard middleware which belongs to <span data-scayt_word="Oberthur" data-scaytid="6">Oberthur Technologies. We were able to establish a session with the card, but can not access the objects within the session. They are <span data-scayt_word="allways" data-scaytid="7">allways empty.

On a VB.NET project, referencing Ncryptoki.dll, when trying to run this piece of code:

Dim <span data-scayt_word="templatePub" data-scaytid="8">templatePub As <span data-scayt_word="CryptokiCollection" data-scaytid="9">CryptokiCollection
Dim <span data-scayt_word="templatePri" data-scaytid="13">templatePri As <span data-scayt_word="CryptokiCollection" data-scaytid="10">CryptokiCollection

<span data-scayt_word="templatePub" data-scaytid="12">templatePub = New <span data-scayt_word="CryptokiCollection" data-scaytid="11">CryptokiCollection()
templatePub.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="17">ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_PUBLIC_KEY))
templatePub.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="18">ObjectAttribute(ObjectAttribute.CKA_TOKEN, True))
templatePub.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="19">ObjectAttribute(ObjectAttribute.CKA_PRIVATE, False))
templatePub.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="22">ObjectAttribute(ObjectAttribute.CKA_LABEL, "<span data-scayt_word="Ugo's" data-scaytid="26">Ugo's new Key"))
templatePub.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="23">ObjectAttribute(ObjectAttribute.CKA_ID, "1"))
templatePub.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="31">ObjectAttribute(ObjectAttribute.CKA_MODULUS_BITS, 1024))
templatePub.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="32">ObjectAttribute(ObjectAttribute.CKA_PUBLIC_EXPONENT, &<span data-scayt_word="H10001" data-scaytid="35">H10001))

<span data-scayt_word="templatePri" data-scaytid="36">templatePri = New <span data-scayt_word="CryptokiCollection" data-scaytid="37">CryptokiCollection()
templatePri.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="38">ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_PRIVATE_KEY))
templatePri.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="39">ObjectAttribute(ObjectAttribute.CKA_TOKEN, True))
templatePri.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="40">ObjectAttribute(ObjectAttribute.CKA_PRIVATE, True))
templatePri.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="41">ObjectAttribute(ObjectAttribute.CKA_LABEL, "<span data-scayt_word="Ugo's" data-scaytid="42">Ugo's new Key 0"))
templatePri.Add(New <span data-scayt_word="ObjectAttribute" data-scaytid="43">ObjectAttribute(ObjectAttribute.CKA_ID, "1"))

Dim keys As Key()

keys = session.GenerateKeyPair(Mechanism.RSA_PKCS_KEY_PAIR_GEN, <span data-scayt_word="templatePub" data-scaytid="45" style="background-color: rgb(255, 255, 255);">templatePub, <span data-scayt_word="templatePri" data-scaytid="46" style="background-color: rgb(255, 255, 255);">templatePri)


It’s always returning <span data-scayt_word="CKR_USER_NOT_LOGGED_IN" data-scaytid="49">CKR_USER_NOT_LOGGED_IN error.

We previously run, successfully, this piece of code:

res = session.Login(session.CKU_USER, "<span data-scayt_word="An3XR1" data-scaytid="51">An3XR1")

Can you help us to overcome this problem?

Thank you in advance.

Best regards,