对 sun.security.pkcs11.SunPKCS11 的访问限制 [英] Access restriction on sun.security.pkcs11.SunPKCS11
问题描述
我正在尝试设置 PKCS11 提供程序以访问智能卡.我在我的系统上安装了一个 PKCS11 库,并按照 Java PKCS#11 参考指南.在引用中,他们只是创建了一个 sun.security.pkcs11.SunPKCS11
的实例,并将配置文件的名称传递给构造函数.当我尝试编译以下代码时
I'm trying to setup a PKCS11 provider for accessing a smartcard.
I installed a PKCS11 library on my system and followed the instructions in the Java PKCS#11 Reference Guide.
In the reference they simply create an instance of sun.security.pkcs11.SunPKCS11
and pass the name of the configuration file to the constructor.
When I try to compile the following code
Provider p = new sun.security.pkcs11.SunPKCS11("pkcs11.cfg");
Security.addProvider(p);
我收到以下错误.
访问限制:由于对所需库/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/ext/sunpkcs11.jar的限制,无法访问构造函数SunPKCS11(String)
Access restriction: The constructor SunPKCS11(String) is not accessible due to restriction on required library /usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/ext/sunpkcs11.jar
我做错了什么?我在 Ubuntu x86 下使用 Eclipse 3.5 和 Java SE 1.6.
What am I doing wrong? I use Eclipse 3.5 with Java SE 1.6 under Ubuntu x86.
最好的问候.
推荐答案
查看项目的属性并打开 Libraries
选项卡.我假设您已将 JRE 系统库
设置为执行环境.将其更改为工作区 JRE 或手动选择特定的 JRE.
Look into the projects's properties and open the Libraries
tab. I assume you have set the JRE System Library
to an execution environment. Change it to the workspace JRE or select a specific JRE manually.
背景:通过选择执行环境,您表示要编写符合 Java API 的应用程序.类 sun.security.pkcs11.SunPKCS11
位于 sun 包中,这将其标记为 Sun Java 实现的专有,而不是标准 Java API 的一部分.
Background:
By selecting an execution environment you say that you want to write an app that is compliant to the Java API. The class sun.security.pkcs11.SunPKCS11
is located in the sun package which marks it as proprietary to Sun Java implementation and is not part of the standard Java API.
这篇关于对 sun.security.pkcs11.SunPKCS11 的访问限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!