在尝试导入证书时,我收到一条错误,导致无法导入,因为在这种情况下别名(tomcat)已经存在
$ keytool -import -v -alias tomcat -file tomcat.crt -keystore ../keystore -storepass changeit
keytool error: java.lang.Exception: Certificate not imported, alias <tomcat> already exists
java.lang.Exception: Certificate not imported, alias <tomcat> already exists
at sun.security.tools.keytool.Main.addTrustedCert(Main.java:2644)
at sun.security.tools.keytool.Main.doCommands(Main.java:1006)
at sun.security.tools.keytool.Main.run(Main.java:340)
at sun.security.tools.keytool.Main.main(Main.java:333)
pvaddepa.wb10d1.koala> (/web/home/wb10d1/companyCA)
当我试图找到别名时,我找不到它 -
pvaddepa.wb10d1.koala> (/web/home/wb10d1/companyCA)
$ keytool -list -storepass changeit
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
companycaroot, Feb 27, 2016, trustedCertEntry,
Certificate fingerprint (SHA1): 44:6C:91:DF:F9:D6:C4:D2:F6:74:0C:5E:7E:25:2B:61:A8:EF:97:A4
我已经提到了similar question on SO,但即使删除后结果也不会改变。
我认为你没有指向同一个密钥库。你可以添加密钥库作为keytool命令的参数打开吗?我的意思是:
keytool -list -storepass changeit -keystore ../keystore
默认情况下,使用的密钥库是.keystore,它不等于您尝试导入证书的密钥库(../keystore)。
如果列出文件夹的内容(/ web / home / wb10d1 / companyCA?),你会发现一个名为.keystore
的文件,但如果列出父文件夹的内容,你会发现keystore
所在的证书带有别名tomcat确实存在。