I never remember the openssl
command needed to create a .pem
file, so I made this bash script to simplify the process:
#!/bin/bash
if [ $# -eq 2 ]
then
echo "Signing $1..."
if ! openssl pkcs12 -in $1 -out $2 -nodes -clcerts; then
echo "Error signing certificate."
else
echo "Certificate created successfully: $2"
fi
else
if [ $# -gt 2 ]
then
echo "Too many arguments"
echo "Syntax: $0 <input.p12> <output.pem>"
else
echo "Missing arguments"
echo "Syntax: $0 <input.p12> <output.pem>"
fi
fi
Name it, for example, signpem.sh
and save it on your user's folder (/Users/<username>
?). After creating the file, do a chmod +x signpem.sh
to make it executable and then you can run:
~/signpem myCertificate.p12 myCertificate.pem
And myCertificate.pem
will be created.