简体   繁体   English

keytool 错误:java.lang.Exception:证书回复和密钥库中的证书相同

[英]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 进行签名,请按照以下步骤操作。

  1. Generate a certificate signing request from your keystore.从您的密钥库生成证书签名请求。 A sample command for the same looks like the one below.相同的示例命令如下所示。

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

  1. Provide the CSR generated with your IT network security team and request them for the signed certificates提供由您的 IT 网络安全团队生成的 CSR 并要求他们提供签名证书

  2. 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.

相关问题 keytool keytool 错误:java.lang.Exception:输入的不是 X.509 证书 - keytool keytool error: java.lang.Exception: Input not an X.509 certificate keytool error:java.lang.Exception:密钥库文件存在,但为空 - keytool error: java.lang.Exception: Keystore file exists, but is empty openssl / keytool错误:java.lang.Exception:输入的不是X.509证书 - openssl/keytool error: java.lang.Exception: Input not an X.509 certificate 如何解决 keytool 错误:java.lang.Exception: Input not an X.509 certificate - How to resolve keytool error: java.lang.Exception: Input not an X.509 certificate keytool 错误:java.lang.Exception:密钥库文件不存在:React Native 中的 debug.keystore - keytool error: java.lang.Exception: Keystore file does not exist: debug.keystore in React Native 升级到jdk1.7.0_79和80(仅Linux)后,获取java.lang.Exception:输入的不是X.509证书:keytool错误 - After upgrading to jdk1.7.0_79 and 80 (linux only) getting java.lang.Exception: Input not an X.509 certificate :keytool error keytool 错误:java.lang.Exception:必须指定 -keyalg - keytool error: java.lang.Exception: The -keyalg must be specified KeyTool 错误:java.lang.Exception:别名不存在 - KeyTool error : java.lang.Exception : Alias does not exist java.lang.Exception:未指定证书文件或文件格式无效 - java.lang.Exception: No Certificate file specified or invalid file format java.lang.Exception:回复中的公钥和密钥库不匹配 - java.lang.Exception: Public keys in reply and keystore don't match
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM