我正在尝试从windows-MY检索所有证书,但其中一些证书具有相同的别名。
因此,下面这段代码只返回这个别名的第一个实例:
KeyStore keyStore = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
Enumeration enumeration = keyStore.aliases();
while (enumeration.hasMoreElements()) {
String alias = enumeration.nextElement().toString();
keyStore.getCertificateChain(alias);
java.security.cert.Certificate[] chain = keyStore.getCertificateChain(alias);
...
}有没有其他方法来检索证书?
发布于 2011-04-08 04:20:34
我也有同样的问题。此Sun错误报告中提到的代码可以工作:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6672015
发布于 2011-03-10 02:52:12
你有没有尝试过for循环?
for (variable in object)
{
code to be executed
}https://stackoverflow.com/questions/5249839
复制相似问题