From 878265f7ffdfd1ddb2e33ce999d9cd9930978e5a Mon Sep 17 00:00:00 2001 From: Duologic Date: Wed, 30 Dec 2015 16:31:55 +0100 Subject: [PATCH 1/4] add tldr for openssl --- pages/common/openssl.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pages/common/openssl.md diff --git a/pages/common/openssl.md b/pages/common/openssl.md new file mode 100644 index 000000000..cd559ef00 --- /dev/null +++ b/pages/common/openssl.md @@ -0,0 +1,23 @@ +# openssl + +> OpenSSL is a cryptography toolkit. + +- Check an SSL connection + +`openssl s_client -connect www.paypal.com:443` + +- Generate new private key and CSR + +`openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key` + +- Read contents of certificate, private key and CSR file + +`openssl x509 -text -noout -in certificate.crt` +`openssl rsa -check -in privateKey.key` +`openssl req -text -noout -verify -in CSR.csr` + +- Check if certificate, private key and CSR have the same MD5 hash + +`openssl x509 -noout -modulus -in certificate.crt | openssl md5` +`openssl rsa -noout -modulus -in privateKey.key | openssl md5` +`openssl req -noout -modulus -in CSR.csr | openssl md5` From 832bf8006c5ab176ddad953d914678adbb61585f Mon Sep 17 00:00:00 2001 From: Duologic Date: Wed, 30 Dec 2015 19:32:23 +0100 Subject: [PATCH 2/4] replace url and paths --- pages/common/openssl.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pages/common/openssl.md b/pages/common/openssl.md index cd559ef00..31bd8ae80 100644 --- a/pages/common/openssl.md +++ b/pages/common/openssl.md @@ -4,20 +4,20 @@ - Check an SSL connection -`openssl s_client -connect www.paypal.com:443` +`openssl s_client -connect {{url}}:443` - Generate new private key and CSR -`openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key` +`openssl req -out {{path/to/CSR.csr}} -new -newkey rsa:2048 -nodes -keyout {{path/to/pivate.key}}` - Read contents of certificate, private key and CSR file -`openssl x509 -text -noout -in certificate.crt` -`openssl rsa -check -in privateKey.key` -`openssl req -text -noout -verify -in CSR.csr` +`openssl x509 -text -noout -in {{path/to/certificate.crt}}` +`openssl rsa -check -in {{path/to/pivate.key}}` +`openssl req -text -noout -verify -in {{path/to/CSR.csr}}` - Check if certificate, private key and CSR have the same MD5 hash -`openssl x509 -noout -modulus -in certificate.crt | openssl md5` -`openssl rsa -noout -modulus -in privateKey.key | openssl md5` -`openssl req -noout -modulus -in CSR.csr | openssl md5` +`openssl x509 -noout -modulus -in {{path/to/certificate.crt}} | openssl md5` +`openssl rsa -noout -modulus -in {{path/to/pivate.key}} | openssl md5` +`openssl req -noout -modulus -in {{path/to/CSR.csr}} | openssl md5` From 9e96e4b64832454c156968743649144a63e7d12b Mon Sep 17 00:00:00 2001 From: Duologic Date: Tue, 5 Jan 2016 15:25:38 +0100 Subject: [PATCH 3/4] used {{domain}} and {{port}} --- pages/common/openssl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/common/openssl.md b/pages/common/openssl.md index 31bd8ae80..9da0ead35 100644 --- a/pages/common/openssl.md +++ b/pages/common/openssl.md @@ -4,7 +4,7 @@ - Check an SSL connection -`openssl s_client -connect {{url}}:443` +`openssl s_client -connect {{domain}}:{{port}}` - Generate new private key and CSR From 32e3a52e30dc0234479dae27d7d7f2594cddb2e0 Mon Sep 17 00:00:00 2001 From: Duologic Date: Tue, 5 Jan 2016 15:26:54 +0100 Subject: [PATCH 4/4] one command code per description --- pages/common/openssl.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pages/common/openssl.md b/pages/common/openssl.md index 9da0ead35..969d3ebec 100644 --- a/pages/common/openssl.md +++ b/pages/common/openssl.md @@ -10,14 +10,26 @@ `openssl req -out {{path/to/CSR.csr}} -new -newkey rsa:2048 -nodes -keyout {{path/to/pivate.key}}` -- Read contents of certificate, private key and CSR file +- Read contents of a certificate `openssl x509 -text -noout -in {{path/to/certificate.crt}}` + +- Read contents of a private key + `openssl rsa -check -in {{path/to/pivate.key}}` + +- Verify a CSR file + `openssl req -text -noout -verify -in {{path/to/CSR.csr}}` -- Check if certificate, private key and CSR have the same MD5 hash +- Check MD5 hash of a certificate `openssl x509 -noout -modulus -in {{path/to/certificate.crt}} | openssl md5` + +- Check MD5 hash of a private key + `openssl rsa -noout -modulus -in {{path/to/pivate.key}} | openssl md5` + +- Check MD5 hash of a CSR file + `openssl req -noout -modulus -in {{path/to/CSR.csr}} | openssl md5`