[英]keytool error: java.lang.Exception: Certificate reply and certificate in keystore are identical
i want to sign my jar file with certificate.我想用证书签署我的 jar 文件。 i have followed below steps.
我遵循了以下步骤。 C:\\Program Files\\Java\\jdk-10.0.2\\bin>keytool -genkey -alias testals -keystore testks
C:\\Program Files\\Java\\jdk-10.0.2\\bin>keytool -genkey -alias testals -keystore testks
C:\\Program Files\\Java\\jdk-10.0.2\\bin>keytool -export -keystore testks -alias testals -file testcer.cer C:\\Program Files\\Java\\jdk-10.0.2\\bin>keytool -export -keystore testks -alias testals -file testcer.cer
Certificate stored in file证书存储在文件中
C:\\Program Files\\Java\\jdk-10.0.2\\bin>keytool -import -alias testals -file testcer.cer -keystore testks C:\\Program Files\\Java\\jdk-10.0.2\\bin>keytool -import -alias testals -file testcer.cer -keystore testks
but while importing getting exception as Certificate reply and certificate in keystore are identical.但是在导入获取异常时,证书回复和密钥库中的证书是相同的。
please help me how can do this?请帮我怎么做?
While importing use different alias name, don't use the alias name which used for exporting.导入时使用不同的别名,不要使用导出时使用的别名。 It will work.
它会起作用。
It's because you are importing the self signed certificate for root, not for the server certificate.这是因为您正在为 root 而不是服务器证书导入自签名证书。
The below are identicals observed from your commands and hence the error.以下是从您的命令中观察到的相同之处,因此是错误。
Keystore Name: testks Alias: testals File: testcer.cer密钥库名称:testks 别名:testals 文件:testcer.cer
If you need your jar signed, do follow the below steps.如果您需要对 jar 进行签名,请按照以下步骤操作。
keytool -certreq -file testks.csr -keystore testks -alias testals -ext SAN=dns:testals keytool -certreq -file testks.csr -keystore testks -alias testals -ext SAN=dns:testals
Provide the CSR generated with your IT network security team and request them for the signed certificates提供由您的 IT 网络安全团队生成的 CSR 并要求他们提供签名证书
Import the certificate reply like you did earlier, but with the signed certificates and you must no longer see this error.像之前一样导入证书回复,但使用签名证书,您一定不会再看到此错误。
Let us know if this worked.让我们知道这是否有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.