jkscerp12

How to convert a p12 file into gateway.jks,cacerts.jks


In my glassfish config file there are 3 key files gateway.jks,cacerts.jks,HOST1.cer. For connecting the the application to remote server the server team provides a .p12 file .I converted that .p12 file to private and public key pair. But unable to create the jks keys from the .p12 file. if any one done this before please help.


Solution

  • if you have .p12 file, using java keytool you can import the cert and key to jk with following command .(e.g your .p12 file is test.p12 and you want to add it to test.jks)

    keytool -importkeystore -srckeystore test.p12 -srcstoretype pkcs12 -destkeystore test.jks -deststoretype JKS
    

    for more detail refer http://xacmlinfo.org/2014/06/13/how-to-keystore-creating-jks-file-from-existing-private-key-and-certificate/