Hi,
I am having problem in resetting the password of slot after removing the 
soft-token associated with it.

Everything works fine for the first time. When I try to create a slot 
second time, the new token is installed
in the previously created empty slot with the old token name and 
protected by the old password.
I want the slot to be in the uninitialized state when I remove the token 
from it or create a new slot every time
I load a different token using SECMOD_OpenUserDB().

(I have followed this document:  
http://developer.mozilla.org/en/docs/NSS_PKCS11_Functions#SECMOD_OpenUserDB.)

Here is how I have created/removed the soft-token:

    PK11SlotInfo *softTokenSlot = NULL;
    char* modspec = "configDir='/tmp/SoftTokenDB/DB11' certPrefix='' 
tokenDescription='SoftToken11' flags='' ";
   softTokenSlot = SECMOD_OpenUserDB(modspec);
  
   // I find the nsIPKCS11Slot using the token name 'SoftToken11' and
   // then set the password using the associated Token as follows:    
  
    nsIPKCS11ModuleDB* mPKCS11ModuleDB;

    nsCOMPtr<nsIPKCS11Module> internalModule;
    rv = mPKCS11ModuleDB->GetInternal(getter_AddRefs(internalModule));
    nsCOMPtr<nsIPKCS11Slot> pkcs11Slot;
    rv = internalModule->FindSlotByName(aSoftTokenName, 
getter_AddRefs(pkcs11Slot));

   nsCOMPtr<nsIPK11Token> softToken;
   rv = pkcs11Slot->GetToken(getter_AddRefs(softToken));
  softToken->Login(PR_FALSE); // prompts for initializing password

   . .  .

   softToken->Reset();  // expected that token/slot password would be in 
the uninitialized state
   SECMOD_CloseUserDB( softTokenSlot);
  
When th slot is closed, the token is removed but the slot is still there 
with the old password.

When I open a new soft-token using SECMOD_OpenUserDB() with a new token 
name, it is installed in
existing the empty slot with the old slot name and protected with the 
old password.
How do I take the empty slot to uninitialized state so that 
'nsIPK11Token.login()' does not prompt for the
old password while asking for the new password?

Thanks for your help.
--
Subrata




  
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to