NSS PKCS11作为jsse提供商运行不佳

时间:2011-12-13 15:43:23

标签: java security fips nss pkcs#11

我使用Network Security Services作为我的Java应用程序的Sun PKCS#11提供程序,并且我遇到了一些不受欢迎的行为。

将相同的可信证书重新插入密钥库将删除最初插入证书时成功设置的信任属性。

以下是一些不完整的代码,用于演示问题的本质:

Provider p = new SunPKCS11(pkcs11ConFile);

Security.addProvider(p);

KeyStore keystore = KeyStore.getInstance("PKCS11");

keystore.load(null, pwd);

pkcs11Keystore.setCertificateEntry(alias, cert);

//at this point, when I use certutil.exe to list the keystore certificate I can see 
//the certificate listed with attributes "CT,C,C" for SSL,S/MIME,JAR/XPI respectively.

keystore.deleteEntry(alias);

keystore.setCertificateEntry(alias, cert);

//now when I run the same certutil.exe command I see empty trust attributes i.e. ",,".

我仍然能够重新加载相同的密钥库(和证书),并且SSL身份验证可以正常运行,但是,当重新启动应用程序并再次重新加载密钥库时,证书在可信别名列表中不可用。

为什么只有在重新启动应用程序时,事情才能起作用对我来说也是一个谜。

我读了一些与http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6298106似乎有关的内容,但它似乎并不适用于100%而且我不了解nss的内部结构以完全理解它。

有没有人理解这种行为?

谢谢,迈克

0 个答案:

没有答案