将.pem文件转换为.jks [英] Convert .pem files to .jks
本文介绍了将.pem文件转换为.jks的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在邮件中收到了两个私有RSA密钥,然后将其复制并保存为 validator.pem
和 user.pem
我曾经用来连接到远程服务器。
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.
现在,我需要将它们转换为 .jks
文件,但是出现以下错误:
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
我正在使用Mac。
推荐答案
转换文件的过程位于
https://docs.oracle.com/cd/E35976_01/server.740/es_admin/src/tadm_ssl_convert_pem_to_jks.html
要将文件转换为pkcs格式,请使用以下命令。您将需要此步骤的CA证书:
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
这篇关于将.pem文件转换为.jks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文