Last active
August 25, 2020 12:07
-
-
Save AdamWorley/92ae16b8dc09db78691625527434e51e to your computer and use it in GitHub Desktop.
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/bash | |
echo "----------------------------------------------" | |
echo " Generate Self Signed Cert" | |
echo "----------------------------------------------" | |
name="clientCert" | |
echo "Generating certificate $name.crt" | |
openssl req -x509 -newkey rsa:4096 -sha256 -days 2190 -nodes -keyout $name.key -out $name.crt -subj "/CN=$name" | |
echo "Creating $name.pfx" | |
openssl pkcs12 -export -in $name.crt -inkey $name.key -out $name.pfx | |
echo "Creating $name.json" | |
base64Thumbprint=$(sha256sum $name.crt) | |
keyid=$(uuidgen) | |
base64Value=$(base64 "$name.crt") | |
printf '{"customKeyIdentifier": "%s", "keyId": "%s", "type": "AsymmetricX509Cert", "usage": "Verify", "value": "%s"}' "$base64Thumbprint" "$keyid" "$base64Value" > $name.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment