Entering password into openssl command from shell script

I am trying to convert p12 to pem from a shell script without user input. I can have the password as a variable in the script.

so when i call:

openssl pkcs12 -in *.p12 -out cert.pem -nodes

      

The terminal prints "Enter Import Password:" and waits for input.

I tried to bind a password with:

echo $PASS | openssl pkcs12 -in *.p12 -out cert.pem -nodes

      

and also trying to use flag with openssl command but can't figure out how to do it.

+3


source to share


1 answer


This one liner worked for me -



openssl pkcs12 -in certificate.p12 -password pass:<your_password> -nodes | openssl x509 -noout -enddate

      

0


source







All Articles