bash - How to convert a directory of .pem files into pkcs12 (.p12) format?

StackOverflow https://stackoverflow.com/questions/19373746

  •  30-06-2022
  •  | 
  •  

سؤال

Using bash, how do I convert a directory full .pem files (with CERTIFICATE and RSA PRIVATE KEY) into pkcs12 (.p12) format with a given password? I have 1,000 .pem files to convert and don't want to do it one-by-one.

هل كانت مفيدة؟

المحلول

for f in *.pem; do openssl pkcs12 -export -out "`basename $f .pem`.p12" -inkey "$f" -in "$f" -certfile ./myca.pem -password pass:myPass; done

Where 'myPass' (no quotes) is the password, and myca.pem is the CA.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top