gpt4 book ai didi

java - 在 64 位 Windows 上找不到 PKCS#11 库

转载 作者:太空宇宙 更新时间:2023-11-04 09:50:34 28 4
gpt4 key购买 nike

在我的工作中,我需要使用智能卡的 certfifcate 对 XML 文件进行签名。一切正常,但在 32 位 Windows 7 VM 上。当我尝试在 64 位 Windows 10 上使用相同的代码时,会出现问题。我收到错误消息“PKCS#11 未找到”和“没有此类算法”。我使用 xades4j 包。我已经尝试过可能在网络上找到的所有解决方案,即

  1. 在 32 位和 64 位版本中使用不同的 .dll 库(pkcs11.dll、opensc-spy.dll、CPPkiP.dll、esp2003csp11.dll)。
  2. 将 .dll 放置在 System32 和 SysWOW64 目录中。
  3. 更新了我的阅读器 (IDBridge CT30) 的驱动程序。
  4. 将 jre 更改为 32 位。
  5. 使用 PKCS11 引用指南中的解决方案(不含 xades4j) - 它也仅适用于 32 位。

没有任何帮助,并且总是发生相同的异常。如果有人知道我还能做什么,我将非常感谢您的提示。

致以诚挚的问候。

Caused by: java.security.KeyStoreException: PKCS11 not found
at java.security.KeyStore.getInstance(Unknown Source)
at java.security.KeyStore$Builder$2$1.run(Unknown Source)
at java.security.KeyStore$Builder$2$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Caused by: java.security.NoSuchAlgorithmException: no such algorithm: PKCS11 for provider SunPKCS11-SmartCard
at sun.security.jca.GetInstance.getService(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Security.getImpl(Unknown Source)
... 11 more

最佳答案

我找到了解决我问题的库。这是https://github.com/esig/dss 。我使用JavaSE11(jdk-11.0.2),pkcs11.dll放置在C:/Windows/System32目录中。在运行应用程序之前,需要添加 VM 参数 -Djava.security.debug=sunpkcs11,pkcs11

关于java - 在 64 位 Windows 上找不到 PKCS#11 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54802323/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com