Convert .pem files to .jks

╄→尐↘猪︶ㄣ 提交于 2020-07-24 04:34:50

问题


I received the two private RSA keys in my mail and I copied and saved it as validator.pem and user.pem which I used to connect to remote server. This is working.

Now, I need to convert them to .jks files, but I get the following errors:

java.lang.Exception: Input not an X.509 certificate


validator.pem
-----BEGIN RSA PRIVATE KEY-----

-----END RSA PRIVATE KEY-----
----------------------------------------------------------
user.pem
-----BEGIN RSA PRIVATE KEY-----

-----END RSA PRIVATE KEY-----


openssl x509 -outform der -in your-cert.pem -out your-cert.crt

unable to load certificate
69095:error:0906D06C:PEM routines:PEM_read_bio:no start line:/SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/crypto/pem/pem_lib.c:648:Expecting: TRUSTED CERTIFICATE

I'm using Mac.


回答1:


The process to convert the files is at

https://docs.oracle.com/cd/E35976_01/server.740/es_admin/src/tadm_ssl_convert_pem_to_jks.html

To convert the file to pkcs format, use below command. you will need CA certificates for this step:

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt


来源:https://stackoverflow.com/questions/33427828/convert-pem-files-to-jks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!