Always request a KeyStore PKCS11 PIN

I have an applet for digital signing. My problem is that the keystore is initialized, but it remains open until the browser closes. How can I request a pin every time I want to sign?

This is the initialization code:

/* Se obtiene el proveedor del contenedor de claves */
pkcs11config = "name=Athena\nlibrary=C:\\Windows\\system32\\asepkcs.dll";
byte[] pkcs11configBytes1 = pkcs11config.getBytes();
ByteArrayInputStream configStream1 = new ByteArrayInputStream(pkcs11configBytes1);
BouncyCastleProvider providerBC = new BouncyCastleProvider();

Security.addProvider(providerBC);
//Cargo el proveedor de la CIPE
providerPKCS11 = new SunPKCS11(configStream1);
Security.addProvider(providerPKCS11);
ks = KeyStore.getInstance("PKCS11", providerPKCS11);
ks.load(null, null); 

Can someone tell me how to fix this? Thank.

+4
source share
2 answers

PKCS № 11 PIN-, . , CKA_ALWAYS_AUTHENTICATE . PIN- , PKCS # 11.

+2

PKCS # 11 , providerPKCS11.logout();, PKCS # 11 - . KeyStore PIN- - . GUI PIN- , .

+1

Source: https://habr.com/ru/post/1536649/


All Articles