Reputation: 1703
I am able to access to a SmartCard with a Java Applet (embedded) using MS CryptoAPI and PKCS#11 (registering the provider with the .dll). I can use both, but right now I'm using the CryptoAPI one for having an easier support for all keyboards/Windows versions:
keystore = KeyStore.getInstance("Windows-MY");
keystore.load(null,null);
I'm using Javascript to comunicate with Java to sign some operations in a web application I am developing.
The default use case is just what I need:
The problem is: It's an embedded Applet. When I sign something in web page A and then I go to web page B (through a link or redirect, for ex.), the Applet is destroyed/created (just like the JVM) and the session is lost so I have to introduce again the PIN. This does not happen if I do not leave/reload the actual web page, of course.
Questions: Is there some way to reuse the session/Applet/JVM programmatically? or loading the Keystore in a way that can avoid this problem?
Possible workaround solutions I already know:
Upvotes: 1
Views: 1378
Reputation: 1703
I ended up doing it in a completely different way: Creating a client desktop app for the signature. This app is installed in all desktop clients (this is ok for me because it's a corporate environment).
This new app listens to a port with a HttpListener
. I connect from the web via javascript (jsonp), send the string to be signed, and it returns the js callback with the result signed.
Upvotes: 1