导入证书出错?
keytool -genkey -keyalg RSA -dname "cn=rahul,ou=OU,o=DEV,c=IN" -alias rahul12 -keypass rahul12 -keystore rahul12.jks -storepass rahul12 -validity 366
keytool -certreq -keyalg RSA -alias rahul12 -keypass rahul12 -keystore rahul12.jks -storepass rahul12 -file rahul12.cert
keytool -import -alias rahul12 -file rahul12.cert -keystore rahul_adapter -storepass rahul_adapter
在第一个命令中,我生成密钥库,在第二个命令中,我生成证书,在第三步中,我在 rahul_adapter(universal keystore) 中导入该证书。导入时出现错误 java.lang.Exception: 输入不是 X.509 证书。任何人都可以告诉我为什么会收到此错误。如何解决该错误并且我还需要证书应该是采用 CSR(证书签名请求)格式而不采用任何其他格式,该怎么做,请帮助我???
keytool -genkey -keyalg RSA -dname "cn=rahul,ou=OU,o=DEV,c=IN" -alias rahul12 -keypass rahul12 -keystore rahul12.jks -storepass rahul12 -validity 366
keytool -certreq -keyalg RSA -alias rahul12 -keypass rahul12 -keystore rahul12.jks -storepass rahul12 -file rahul12.cert
keytool -import -alias rahul12 -file rahul12.cert -keystore rahul_adapter -storepass rahul_adapter
In 1st command i am generating KeyStore, In 2nd command i am generating certificate and in 3rd step i am importing that certificate in rahul_adapter(universal keystore) . While importing it is giving Error java.lang.Exception: Input not an X.509 certificate.Can anybody tell me why i am getting this error.How to resolve that error and i also need certificate should be in CSR(Certificate Signing Requests) format not in any other format how to do that please help me????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案非常明显 - 第二步中会生成 CSR,并将其导入到 keytsore 中。
CSR 与证书不同,必须使用它从证书颁发机构获取实际证书。
顺便说一句,如果这是您尝试设置的开发环境,那么最好使用自签名证书。此外,使用 JDK 6 作为 keytool 的 genkeypair 选项JDK 6 中的 自动创建一个私钥和一个公钥(带有 X.509 证书),可以使用 exportcert 选项将其导出。
The answer to this is quite obvious - a CSR is being generate in the second step, and the same is being imported into the keytsore.
A CSR is not the same as a certificate, and it must be utilized to obtain the actual certificate from a certificate authority.
By the way, if this is a development environment that you are trying to setup, you are better off using self-signed certificates. Moreover, use JDK 6, as the genkeypair option of keytool in JDK 6 automatically creates a private key and a public key (with a X.509 certificate), which can be exported using the exportcert option.