Hi there, I am testing out the NSS 3.8 PKCS#11 Soft Token, and have managed
to load it correctly and initialise it correctly.  However I note from the
returned flags of C_GetTokenInfo that the token is write protected, and this
is obviously why my calls to C_GenerateKey are failing with
CKR_TOKEN_WRITE_PROTECTED.

Could someone please tell me how I remove the write protection from the
token?  Is it necessary for me to login to the "NSS Certificate DB" token to
do this?

Here is the debug out from my application - does anyone know what the
"Unknown" token flag 0x8000 is, that is returned by C_GetTokenInfo?

Pkcs11_Initialize
  Copying elements from caller-provided init structure
  Initializing with: configDir='c:/nss/config' certPrefix='' keyPrefix=''
secmod='secmod.db'
  Calling C_Initialize with modified init structure
snetpk11.dll: DllMain(hModule=0x00230000, dwReason=2)
snetpk11.dll: DllMain(hModule=0x00230000, dwReason=2)
  C_Initialize succeeded
Pkcs11_GetSlotList(tokenPresent=1)
  C_GetSlotList succeeded: pSlotList=0x00000000, *pulCount=2
Pkcs11_GetSlotList(tokenPresent=1)
  C_GetSlotList succeeded: pSlotList=0x008218C0, *pulCount=2
  [0] = SlotID 1
  [1] = SlotID 2
Pkcs11_GetTokenInfo(slotID=1)
  C_GetTokenInfo succeeded: label=NSS Generic Crypto Services,
manufacturerID=mozilla.org, model=NSS 3, serialNumber=0000000000000000,
flags=0x8003, ulMaxSessionCount=0, ulSessionCount=0, ulMaxRwSessionCount=0,
ulMaxPinLen=0, ulMinPinLen=0, ulTotalPublicMemory=0, ulFreePublicMemory=0,
ulTotalPrivateMemory=0, ulFreePrivateMemory=0
  Token Flags: CKF_RNG, CKF_WRITE_PROTECTED, Unknown Flags: 0x8000.
Pkcs11_GetTokenInfo(slotID=2)
  C_GetTokenInfo succeeded: label=NSS Certificate DB,
manufacturerID=mozilla.org, model=NSS 3, serialNumber=0000000000000000,
flags=0x800c, ulMaxSessionCount=0, ulSessionCount=0, ulMaxRwSessionCount=0,
ulMaxPinLen=255, ulMinPinLen=0, ulTotalPublicMemory=1, ulFreePublicMemory=1,
ulTotalPrivateMemory=1, ulFreePrivateMemory=1
  Token Flags: CKF_LOGIN_REQUIRED, CKF_USER_PIN_INITIALIZED, Unknown Flags:
0x8000.
Pkcs11_OpenSession(slotID=1, flags=0x6)
  Session Flags: CKF_RW_SESSION, CKF_SERIAL_SESSION.
  C_OpenSession succeeded: *phSession=0x1
Pkcs11_GenerateKey(hSession=0x1, pMechanism->mechanism=0x131)
  C_GenerateKey failed: CKR_TOKEN_WRITE_PROTECTED
Pkcs11_CloseSession(hSession=0x1)
  C_CloseSession succeeded
Pkcs11_Finalize
  C_Finalize succeeded


_______________________________________________
mozilla-crypto mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-crypto

Reply via email to