问题
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