To generate the Private key from the .jks file from linux/unix server.
We can use keytool and openssl utility to generate the private key from a .crt/.jks file.
Command to use:
Go to the location where your certificate file is located.
Using Keytool command generate keystore file
keytool -v -importkeystore -srckeystore keystore.jks -srcalias keyalias -destkeystore keystore.p12 -deststoretype PKCS12
Using Openssl generate the .pem file which contains the private key
openssl pkcs12 -in keystore.p12 -out keystore.pem
keystore.jks – This file is your certificate file. It will be either in .crt or .jks format.
The keystore.pem contains your private key.
While running the command if it prompts for password you should give it as per the password added while creating a cert file.