Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Carlos Wu
Added: Jul 11, 2018 5:20 AM
Modified: Jul 11, 2018 7:06 AM
Views: 1
Tags: crt jks pem
Download OpenSSL from https://bintray.com/vszakats/generic/openssl
  1.  
  2.  
  3. <JRE8>\keytool -importkeystore -srckeystore <Source-Java-Key-Store-File> -destkeystore <Destination-Pkcs12-File> -srcstoretype jks -deststoretype pkcs12 -destkeypass <Destination-Key-Password>
  4.  
  5. openssl pkcs12 -in <Destination-Pkcs12-File> -out <Destination-Pem-File>
  6.  
  7. openssl x509 -outform der -in <Destination-Pem-File> -out <Destination-Crt-File>
  8.  
  9. openssl rsa -in <Destination-Pem-File> -out <Destination-Key-File>
  10.  
  11. ------------------------Another Way----
  12. Export the .crt:
  13. keytool -export -alias mydomain -file mydomain.der -keystore mycert.jks
  14.  
  15. convert the cert to PEM:
  16. openssl x509 -inform der -in mydomain.der -out certificate.pem
  17.  
  18. export the key:
  19. keytool -importkeystore -srckeystore mycert.jks -destkeystore keystore.p12 -deststoretype PKCS12
  20.  
  21. concert PKCS12 key to unencrypted PEM:
  22. openssl pkcs12 -in keystore.p12  -nodes -nocerts -out mydomain.key
  23.  
  24.