我制定了法律,以检查在某种行动之前是否在常设法院发现了某种安全隐患。 我现在使用的法典是:
private KeyStore getKeyStore() {
try {
KeyStore keyStore = KeyStore.getInstance("PKCS11",getProvider()); //$NON-NLS-1$
char [] pin = "mypin".toCharArray();
keyStore.load(null, pin);
return keyStore;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private Provider getProvider() throws ClassNotFoundException,
NoSuchMethodException, SecurityException, InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Class<?> lclass = ClassLoader.getSystemClassLoader().getParent().loadClass("sun.security.pkcs11.SunPKCS11"); //$NON-NLS-1$
@SuppressWarnings("rawtypes")
Constructor constructor = lclass.getConstructor(String.class);
return (Provider) constructor.newInstance(configName);
}
如果安全标注(USB smartcard)是申请首次试图进入钥匙储存地,它就会顺利运行,没有错误;但如果智能卡不是第一次出现申请,则<代码>。 关键仓库.getInstance提出了这一例外:
java.security.KeyStoreException: PKCS11 not found
at java.security.KeyStore.getInstance(Unknown Source)
at es.giro.girlabel.token.Token.getKeyStore(Token.java:120)
at es.giro.girlabel.token.Token.getCertificate(Token.java:156)
at es.giro.girlabel.token.Token.hasToken(Token.java:150)
at es.giro.girlabel.jobs.JobList.getInstance(JobList.java:73)
at es.giro.girlabel.editor.view.LabelListView$10.run(LabelListView.java:499)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at es.giro.girlabel.Application.start(Application.java:39)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Caused by: java.security.NoSuchAlgorithmException: no such algorithm: PKCS11 for provider SunPKCS11-eToken
at sun.security.jca.GetInstance.getService(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Security.getImpl(Unknown Source)
... 35 more
在第一次尝试之后,如果我 back倒安全感,重整行动,我就犯了同样的错误。
SunPKCS11是否对一些数据进行分类? 如果是的话,是否有办法清除这种藏匿点?
感谢您的关注,请原谅。 英语不是我的母语。
EDIT:
完整的跟踪:
java.security.KeyStore.getInstance(Unknown Source)
es.giro.girlabel.token.Token.getKeyStore(Token.java:119)
es.giro.girlabel.token.Token.getCertificate(Token.java:160)
es.giro.girlabel.token.Token.hasToken(Token.java:154)
es.giro.girlabel.jobs.JobList.getInstance(JobList.java:73)
es.giro.girlabel.editor.view.LabelListView$10.run(LabelListView.java:499)
org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
es.giro.girlabel.Application.start(Application.java:39)
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
org.eclipse.equinox.launcher.Main.run(Main.java:1408)
org.eclipse.equinox.launcher.Main.main(Main.java:1384)