2015-12-30 16:31:55 +01:00
|
|
|
# openssl
|
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
> OpenSSL cryptographic toolkit.
|
2015-12-30 16:31:55 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
- Generate a 2048bit RSA private key and save it to a file:
|
2015-12-30 16:31:55 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
`openssl genrsa -out {{filename.key}} 2048`
|
2015-12-30 16:31:55 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
- Generate a certificate signing request to be sent to a certificate authority:
|
2015-12-30 16:31:55 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
`openssl req -new -sha256 -key {{filename.key}} -out {{filename.csr}}`
|
2015-12-30 16:31:55 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
- Read contents of a signed certificate:
|
2015-12-30 16:31:55 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
`openssl x509 -text -noout -in {{certificate.crt}}`
|
2016-01-05 15:26:54 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
- Display the certificate presented by an SSL/TLS server:
|
2016-01-05 15:26:54 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
`openssl s_client -connect {{host}}:{{port}} </dev/null`
|
2016-01-05 15:26:54 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
- Display the complete certificate chain of an HTTPS server:
|
2016-01-05 15:26:54 +01:00
|
|
|
|
2016-01-20 10:11:47 -08:00
|
|
|
`openssl s_client -connect {{google.com}}:{{443}} -showcerts </dev/null`
|