Hello,
I am constinally running into the following error.
Java: org.opensc.pkcs11.wrap.PKCS11Exception: C_Login for PKCS11 slot 0
failed. (CKR_USER_ALREADY_LOGGED_IN)
Problem is I am not 100% sure how to Log a person out. The keystore has no
destroy method and I can't have the applet load and unload every time the
user needs to sign data. I also used the PKCS11Session.destroy() method but
that doesn't save me from this error either.
Anyone with more experience using opensc have a solution?
Here is my java function. It works the first time it's called. Then when its
called a second time boom I get that error.
My Code:
Public String Function(Stuff){
KeyStore keyStore = KeyStore.getInstance("PKCS11","OpenSC-PKCS11");
keyStore.load(params); <----prompts to enter pin
CMSSignedDataGenerator generator = new CMSSignedDataGenerator();
generator.addSigner(privatekey,
(X509Certificate)keyStore.getCertificate(alias),
CMSSignedDataGenerator.DIGEST_SHA1);
generator.addCertificatesAndCRLs(getCertStore(keyStore, alias));
CMSProcessable content = new
CMSProcessableByteArray(data.getBytes(StringUtil.CHARSET_NAME_UTF16LE));
CMSSignedData signedData = generator.generate(content, true,
provider.getName());
String retValB64 = Base64.encode(signedData.getEncoded());
keyStore = null; <---- tried to null out the keystore still get
error.
return retValB64;
}
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel