eagerToLearn
eagerToLearn

Reputation: 429

Convert .pem files to .jks

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.

Upvotes: 1

Views: 10594

Answers (1)

NPC
NPC

Reputation: 869

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

Upvotes: -1

Related Questions