tldr/pages/common/openssl.md

37 lines
1.1 KiB
Markdown
Raw Normal View History

2015-12-30 15:31:55 +00:00
# openssl
> OpenSSL cryptographic toolkit.
2019-06-04 10:00:15 +01:00
> More information: <https://www.openssl.org>.
2015-12-30 15:31:55 +00:00
- Generate a 2048bit RSA private key and save it to a file:
2015-12-30 15:31:55 +00:00
`openssl genrsa -out {{filename.key}} 2048`
2015-12-30 15:31:55 +00:00
- Generate a certificate signing request to be sent to a certificate authority:
2015-12-30 15:31:55 +00:00
`openssl req -new -sha256 -key {{filename.key}} -out {{filename.csr}}`
2015-12-30 15:31:55 +00:00
- Generate a self-signed certificate from a certificate signing request valid for some number of days:
2015-12-30 15:31:55 +00:00
`openssl x509 -req -days {{days}} -in {{filename.csr}} -signkey {{filename.key}} -out {{filename.crt}}`
2016-01-05 14:26:54 +00:00
- Display certificate information:
`openssl x509 -in {{filename.crt}} -noout -text`
- Display a certificate's expiration date:
`openssl x509 -enddate -noout -in {{filename.pem}}`
- Display the start and expiry dates for a domain's certificate:
`openssl s_client -connect {{host}}:{{port}} 2>/dev/null | openssl x509 -noout -dates`
- Display the certificate presented by an SSL/TLS server:
2016-01-05 14:26:54 +00:00
`openssl s_client -connect {{host}}:{{port}} </dev/null`
2016-01-05 14:26:54 +00:00
- Display the complete certificate chain of an HTTPS server:
2016-01-05 14:26:54 +00:00
2016-02-10 04:58:44 +00:00
`openssl s_client -connect {{host}}:443 -showcerts </dev/null`