Created
January 13, 2013 03:14
-
-
Save tchn/4522053 to your computer and use it in GitHub Desktop.
generate PEM (1) client cert (2) ca cert (3) private key file from PKCS12 client cert, to be used by wget and other commandline http client.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
yourp12="$1" | |
clcert="${yourp12}-clcert.pem" | |
cacert="${yourp12}-cacert.pem" | |
keyfile="${yourp12}-key.pem" | |
echo -n "Type passphrase: " | |
read -s passwd | |
openssl pkcs12 -in "$1" -clcerts -nokeys -out "$clcert" -passin pass:"$passwd" | |
openssl pkcs12 -in "$1" -cacerts -nokeys -out "$cacert" -passin pass:"$passwd" | |
openssl pkcs12 -in "$1" -nocerts -nodes -out "$keyfile" -passin pass:"$passwd" | |
# wget --certificate="$clcert" --private-key="$keyfile" --ca-certificate="$cacert" https://example.com/secret/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment