Here is my sample code:
File acpkcs64bit = new File("C:\\Progra~2\\ActivIdentity\\ActivClient\\acpkcs211.dll");
File pkcsProperties = new File("C:\\TestDir\\pkcs11.properties");
Security.addProvider(new sun.security.pkcs11.SunPKCS11(pkcsProperties.getPath()));
CallbackHandler cardCallbackHandler = new CallbackHandler() {
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {} };
cardKeystoreBuilder = KeyStore.Builder.newInstance("PKCS11", null, new KeyStore.CallbackHandlerProtection(cardCallbackHandler());
KeyStore keyStore = cardKeystoreBuilder.getKeyStore();
When the code tries to initialize the KeyStore object, I get the exception CKR_ATTRIBUTE_TYPE_INVALID.
I do have ActivClient installed on my machine.
The contents of my pkcs11.properties file are as follows:
name=ActivClient
library = C:\Program~2\ActivIdentity\ActivClient\acpkcs211.dll
I apologize if I posted this in the wrong location. I'd appreciate any help you can give me.
Also, I am using Java JDK 1.7.0_45.