繁体   English   中英

关于类sun.security.pkcs11.SunPKCS11的错误

[英]Error on class sun.security.pkcs11.SunPKCS11

我已经使用此代码在java1.4中创建了keyStore。

 `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`

请告诉我解决方案。 如何下载49以下版本的类(如48等)

Java 1.5中引入了SunPKCS11

您必须升级Java版本,否则将无法使用它。

提升项目并不少见。 “该项目已经在运行”并不是避免这种情况的原因,因为它是持续开发过程中的预期部分。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM