Created
March 6, 2017 02:23
-
-
Save naillizard/1dfb21404b1f7d49a5ca6f643fc1be8e to your computer and use it in GitHub Desktop.
[openssl] Self-Signed certificates #tags: x509, ssl, tls, openssl
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
# generate encryption key .pem or .key | |
openssl genrsa 2048 > $1.key | |
# generate selfsigned certificate .crt optionally | |
openssl req -x509 -new -nodes -days $2 -key $1.key -subj "/CN=$1" > $1.pem | |
openssl genrsa 2048 > $1_device.key | |
# generate certificate sign request .pem or .csr | |
openssl req -new -key $1_device.key -subj "/CN=$1" > $1_device.csr | |
# generate selfsigned certificate and CA | |
openssl x509 -req -days $2 -in $1_device.csr -CA $1.pem -CAkey $1.key -CAcreateserial > $1.crt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment