简体   繁体   中英

convert .pem to jks with out key file

i am trying to convert .pem file to .jks but i am unable to do it. the cert.pem has passphrase only but not any key file.

i tried this:

openssl pkcs12 -export -nokeys -in cert.pem -out cert.p12

keytool -importkeystore -srckeystore cert.p12 -srcstoretype pkcs12 -srcstorepass login1 -destkeystore trustStore.jks

and i got :

Import command completed: 0 entries successfully imported, 0 entries failed or cancelled .

and created trustStore.jks is empty.

how to do it?

When you have a certificate file (.pem file), you usually add it to a keystore, but not convert it.

In order to add a certificate to a keystore (new/existing), you can run this keytool command:

keytool -importcert -keystore "KEYSTORE_FILE" -storepass "KEYSTORE_PASSWORD" -file "CERTIFICATE_FILE" -alias "CERTIFICATE_ALIAS"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM