[edit] So much for that. It turns out that openssl is able to determine that the key and certificate are already in a single file. Therefore, no csplitting required (man, I hope somebody reading this at least learned about how nice csplit is). In fact, the whole script might as well be obsolete… blaargh. Well, at least it gives a nice warning about not giving a blank passphrase. 😀
Here’s the new version:
pem2pfx – converts a .pem-formatted file containing a private key and signed certificate into a Windows-compatible .pfx certificate file.
#!/bin/bash #pem2pfx #v0.2 #Tricky - brendan@swiftspirit.co.za # Converts a .pem certificate file to .pfx format # $1 is the source file set -e kon [ $# = 1 ]; then outputfile=`echo $1 | sed 's/.pem$/.pfx/'` echo "Please specify a password below. Windows refuses to import a .pfx certificate with a blank password." openssl pkcs12 -export -out $outputfile -in $1 else echo "pem2pfx - converts a .pem formatted private-key and certificate file to an IIS-compatible .pfx file." echo "Usage: pem2pfx inputfile.pem" fi |
Mga bag-ong Comments