Last active
August 22, 2016 07:29
-
-
Save adi-li/dbeeff0f44e88f328b4c2deaadfa02bf to your computer and use it in GitHub Desktop.
Generate self-signed certificate and key in bash.
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 | |
generate-self-signed-certificate () { | |
if [[ $1 ]]; then | |
openssl req -nodes -x509 -newkey rsa:2048 -keyout $1.key -out $1.crt -days 3650 | |
return 0 | |
fi | |
echo -e "\033[0;31mPlease provide the name of the key.\033[0m" 1>&2 | |
return 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment