public static void main(String[] args ) throws IOException, DocumentException, GeneralSecurityException { String pkcs11Config = "name=eToken\nlibrary=C://WINDOWS//system32//eTPKCS11.dll"; java.io.ByteArrayInputStream pkcs11ConfigStream = new java.io.ByteArrayInputStream(pkcs11Config.getBytes()); sun.security.pkcs11.SunPKCS11 providerPKCS11 = new sun.security.pkcs11.SunPKCS11(pkcs11ConfigStream); java.security.Security.addProvider(providerPKCS11); // Get provider KeyStore and login with PIN String pin = "123456"; java.security.KeyStore keyStore =java.security.KeyStore.getInstance("PKCS11", providerPKCS11); keyStore.load(null, pin.toCharArray()); // Enumerate items (certificates and private keys) in the KeyStore java.util.Enumeration<String> aliases = keyStore.aliases(); String alias=null; while (aliases.hasMoreElements()) { alias = aliases.nextElement(); System.out.println(alias); }}
Error(2,28): cannot access class sun.security.pkcs11.SunPKCS11; class file has wrong version 49.0, should be 45.3 or 46.0 or 47.0 or 48.0`
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)