openssl/keytool错误:java.lang.Exception:输入的不是X.509证书 [英] openssl/keytool error: java.lang.Exception: Input not an X.509 certificate
本文介绍了openssl/keytool错误:java.lang.Exception:输入的不是X.509证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经通过Openssl创建了证书
I have created certificate through Openssl
Openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=nginxsvc/O=nginxsvc"
,然后使用OpenSSL创建PKCS#12文件:
and then created a PKCS#12 file using OpenSSL:
openssl pkcs12 -export -in tls.crt -inkey tls.key -out tls.p12
然后使用
keytool -importkeystore -srckeystore tls.p12 -srcstoretype PKCS12 -destkeystore tls.jks -deststoretype JKS
现在通过这样的keytool导入此jks文件
now when importing this jks file through keytool like this
keytool -import -noprompt -trustcacerts -alias "nginxsvc" -file tls.jks -keystore "C:\Program Files\Java\jdk1.8.0_152\jre\lib\security\cacerts"
我得到
keytool错误:java.lang.Exception:输入的不是X.509证书
keytool error: java.lang.Exception: Input not an X.509 certificate
推荐答案
-import
需要一个证书文件,而不是JKS.尝试:
The -import
needs a certificate file, not a JKS.
Try :
keytool -import -noprompt -trustcacerts -alias "nginxsvc" -file tls.crt -keystore "C:\Program Files\Java\jdk1.8.0_152\jre\lib\security\cacerts"
这篇关于openssl/keytool错误:java.lang.Exception:输入的不是X.509证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文