将一个证书存储到我的Java密钥库中后出现多个条目 [英] Multiple entries after storing one single certificate into my Java keystore
问题描述
我正在使用 但是当我尝试列出密钥库中的所有条目: 我很确定密钥库是由我的代码生成的,并且最初应该是空的.我想知道其他159个条目来自何处? 谢谢. 使用KeyStoreExplorer比较两个信任库:Installcert类生成的jssecacerts和Java> jre> security> lib中的cacerts文件. Istallcert从服务器获取证书,并创建您正在使用的JVM的信任库的副本.然后将证书添加到您的信任库的副本中,并将其命名为"jssecacerts".检查这段代码: 然后,您只需要将jsscacerts重命名为cacerts并替换JVM上的原始证书即可. I'm using the class InstallCert to import a VMware vCenter certificate into my local Java keystore. The line Then I store the downloaded certificate into my local keystore by using the following snippet. But when I try to list all the entries in the keystore: I'm pretty sure that the keystore is generated by my code, and it is supposed to be initially empty. I'd like to know where do the other 159 entries come from ? Thanks. Use KeyStoreExplorer for comparing both truststores: jssecacerts generated by the Installcert class, and the cacerts file located en your Java>jre>security>lib. Istallcert takes the certificate from the server and creates a copy of the truststore of the JVM you are using. then it adds the certificate to the copy of your truststore, and names it "jssecacerts". Check this piece of code: You then just need to rename jsscacerts to cacerts and replace the original one on your JVM 这篇关于将一个证书存储到我的Java密钥库中后出现多个条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!keytool -list -keystore jssecacerts -v
时,它表明有160个条目,其中包括我已下载的条目.socket.startHandshake()
returns an UnsupportedOperationException
, but the class SavingTrustManager
still has downloaded the certificate successfully.KeyStore jsk;
... ... ..
jks.setCertificateEntry(alias, cert);
OutputStream out = new FileOutputStream("jssecacert");
jks.store(out, passphrase);
out.close();
keytool -list -keystore jssecacerts -v
, It shows that there are 160 entries including the one that I have downloaded.File file = new File("jssecacerts");
if (file.isFile() == false) {
char SEP = File.separatorChar;
File dir = new File(System.getProperty("java.home") + SEP
+ "lib" + SEP + "security");
file = new File(dir, "jssecacerts");
if (file.isFile() == false) {
file = new File(dir, "cacerts");
}
}