Skip to content

Instantly share code, notes, and snippets.

@balos1
Created January 12, 2017 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balos1/e63a7a956a5921298768457e0916ecfd to your computer and use it in GitHub Desktop.
Save balos1/e63a7a956a5921298768457e0916ecfd to your computer and use it in GitHub Desktop.
Useful for creating certificates for Microsoft Azure subscriptions management and many other things.
#!/bin/bash
if [ -z "$1"]
then
echo "./create.cert <name>"
echo "please provide name argument"
exit 1
else
name=$1
fi
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $name.pem -out $name.pem
openssl pkcs12 -export -out $name.pfx -in $name.pem -name "$name"
openssl x509 -inform pem -in $name.pem -outform der -out $name.cer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment