小编Pep*_*rez的帖子

Java 9中的SunPKCS11提供程序

在Java 8之前,SunPKCS11提供程序的加载方式如下:

Provider provider = new sun.security.pkcs11.SunPKCS11 (new ByteArrayInputStream (configFile.getBytes ()));
Security.addProvider (provider);
Run Code Online (Sandbox Code Playgroud)

configFile是带有配置参数的String.因此,如果应用程序需要使用多个连接的智能卡,它可以创建多个提供程序.要访问每个提供程序,使用的名称是"SunPKCS11-",后跟我们在配置中指示的名称.

在Java 8中,sun.security.pkcs11.SunPKCS11该类已在JDK中删除.所以,我不得不通过反思来编程前一个调用.

Java 9中PKCS#11提供程序的操作似乎非常不同:

  • SunPKCS11构造已更改为空单.配置由"configure"方法加载,因此必须将它放在磁盘上的文件中,我不能再通过流将其加载到字符串.

  • 如果我们尝试使用反射,则会出现以下警告:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by PruebaTarjeta (file:/C:/temp/pkcs11java9/classes/) to constructor
sun.security.pkcs11.SunPKCS11()
WARNING: Please consider reporting this to the maintainers of PruebaTarjeta
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Run Code Online (Sandbox Code Playgroud)
  • 在Java 9中,SunPKCS11提供程序是自动生成的,位于加密提供程序列表中.它可以从列表中获取并进行配置.问题是您只能在列表中加载一个PKCS#11提供程序.在Java的9文档 …

java pkcs#11 java-9 sunpkcs11

19
推荐指数
1
解决办法
4421
查看次数

标签 统计

java ×1

java-9 ×1

pkcs#11 ×1

sunpkcs11 ×1