2012-09-05 24 views
1

请你能为我提供更多有关提供者设置更改的提示吗?关于SignTTest的一些更多提示

我可以在PKCS11KeyStoreKeyingDataProvider.java看到:

public class PKCS11KeyStoreKeyingDataProvider extends KeyStoreKeyingDataProvider 
{ 
    /** 
    * 
    * @param nativeLibraryPath the path for the native library of the specific PKCS#11 provider 
    * @param providerName this string is concatenated with the prefix SunPKCS11- to produce this provider instance's name 
    * @param certificateSelector the selector of signing certificate 
    * @param keyStorePasswordProvider the provider of the keystore loading password (may be {@code null}) 
    * @param entryPasswordProvider the provider of entry passwords (may be {@code null}) 
    * @param returnFullChain indicates of the full certificate chain should be returned, if available 
    * @throws KeyStoreException 
    */ 
    public PKCS11KeyStoreKeyingDataProvider(
      final String nativeLibraryPath, 
      final String providerName, 
      SigningCertSelector certificateSelector, 
      KeyStorePasswordProvider keyStorePasswordProvider, 
      KeyEntryPasswordProvider entryPasswordProvider, 
      boolean returnFullChain) throws KeyStoreException 
    { 

,并在我的SignerTTest.java:

PKCS11KeyStoreKeyingDataProvider ptccKeyingDataProv = new PKCS11KeyStoreKeyingDataProvider 
       ("D:\\pteidpkcs11.dll", 
       "pteidpkcs11", 
       new FirstCertificateSelector(), null, null, false); 

但我不明白,平时我下载.DLL适当所以这里该库pteidpkcs11.dll位于D:(所以在Java我把“\\”:“D:”\\“pteidpkcs11.dll”)

我把.dll的名称,所以这里pteidpkcs11作为参数。

“new FirstCertificateSelector()”是选择密钥库列表的第一个证书后,是不是?

第一个空值是密钥库提供者的密码,不是吗?

第二个空值是证书的密码,不是吗?

而returnFullChain究竟是什么角色?

我想要了解如何配置提供程序的信息,因为在我搜索过程中,目前还不清楚。

谢谢,

威廉。

回答

1

new FirstCertificateSelector()是选择密钥库列表的第一个证书,不是吗?

是的。您可以通过SigningCertSelector接口的任何其他实施。

第一个空值是密钥库提供者的密码,不是吗? 第二个空值是证书的密码,不是吗?

是的。它是空的,因为特定的PKCS#11提供程序处理密钥存储条目的保护(这是一个带有PIN的智能卡)。

而returnFullChain它的作用究竟是什么?

密钥库中的条目可能包含一个密钥以及具有完整证书链的关联证书。该参数控制getSigningCertificateChain方法是返回完整链还是仅返回叶证书。

适当的配置和DLL将取决于您使用的PKCS11提供程序。在那次测试中,我使用了葡萄牙公民卡和智能卡读卡器。请注意,PKCS11KeyStoreKeyingDataProvider只是基于sun的PKCS11提供程序的Java密钥存储的适配器。