Created
October 22, 2019 13:58
-
-
Save tonybaines/ba548f405eb340a4cf52d9b835790275 to your computer and use it in GitHub Desktop.
openssl commands for public key stuff without interaction
This file contains hidden or 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
openssl req -newkey rsa:4096 -nodes -keyform PEM \ | |
-subj "/C=GB/ST=Suffolk/L=Ipswich/O=foobar/CN=trust.foobar.com" \ | |
-keyout etc/CA.key -x509 -days 9999 -outform PEM -out etc/CA.pem |
This file contains hidden or 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
openssl genrsa -out etc/client.key 4096 && \ | |
openssl req -new -key etc/client.key -out etc/client.req \ | |
-subj "/C=GB/ST=Suffolk/L=Ipswich/O=foobar/CN=client.foobar.com" && \ | |
openssl x509 -req -in etc/client.req -CA etc/CA.pem -CAkey etc/CA.key -set_serial 101 \ | |
-extensions client -days 9999 -outform PEM -out etc/client.pem && \ | |
openssl x509 -in etc/client.pem -outform DER | openssl dgst -sha256 | \ | |
cut -d" " -f2 | tr 'A-Z' 'a-z' > etc/client.sha256 && \ | |
rm etc/client.req |
This file contains hidden or 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
openssl req -new -newkey rsa:4096 -days 9999 -nodes -x509 \ | |
-subj "/C=GB/ST=Suffolk/L=Ipswich/O=foobar/CN=untrusted.foobar.com" \ | |
-keyout etc/untrusted.key -out etc/untrusted.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment