openssl ptr

View the contents of a CSR

To view a CSR you can use our online CSR Decoder. However, if you prefer to decode your CSR locally use the command below.
openssl req -in req.pem -noout -text

Verify the signature on a CSR

To verify the signature on a CSR you can use our online CSR Decoder, or you can use the command below.
openssl req -in req.pem -noout -verify

Create a self-signed certificate

To create a self-signed certificate, sign the CSR with its associated private key
openssl x509 -req -days 365 -in req.pem -signkey key.pem -out cert.pem
To create a self-signed certificate, with one command use the command below. This generates a 2048 bit key and associated self-signed certificate with a one year validity period.
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365

View the contents of a certificate

To view a certificate you can use our online Certificate Decoder. However, if you prefer to decode your certificate locally use the command below.
openssl x509 -in cert.pem -noout -text

Create a test SSL server

The OpenSSL s_server command implements a generic SSL/TLS server. It should be used for test purposes only. The example below listens for connections on port 8080 and returns an HTML formatted status page that includes lots of information about ciphers.
openssl s_server -key key.pem -cert cert.pem -accept 8080 -www

Convert a certificate from PEM to DER format

openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER 

Convert a certificate from DER to PEM format

openssl x509 -in cert.der -inform DER -out cert.pem -outform PEM 

Convert a CSR from PEM to DER format

openssl req -in csr.pem -out csr.der -outform DER

Convert a CSR from DER to PEM format

openssl req -in csr.der -inform DER -out csr.pem -outform PEM

Get the SHA-1 fingerprint of a certificate or CSR

You can use our CSR and Cert Decoder to get the SHA1 fingerprint of a certificate or CSR. The decoder converts the CSR/certificate to DER format before calculating the fingerprint.
To get the SHA1 fingerprint of a certificate using OpenSSL, use the command shown below.
openssl dgst -sha1 certificate.der
To get the SHA1 fingerprint of a CSR using OpenSSL, use the command shown below.
openssl dgst -sha1 csr.der

Get the MD5 fingerprint of a certificate or CSR

You can use our CSR and Cert Decoder to get the MD5 fingerprint of a certificate or CSR. The decoder converts the CSR/certificate to DER format before calculating the fingerprint.
To get the MD5 fingerprint of a certificate using OpenSSL, use the command shown below.
openssl dgst -md5 certificate.der
To get the MD5 fingerprint of a CSR using OpenSSL, use the command shown below.
openssl dgst -md5 csr.der

Grab a website's SSL certificate

openssl s_client -connect www.somesite.com:443 > cert.pem
Now edit the cert.pem file and delete everything except the PEM certificate.
The command below makes life even easier as it will automatically delete everything except the PEM certificate.
echo -n | openssl s_client -connect mysite.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > pem.cert
If the webserver has several certificates on one IP address, then you will need to tell OpenSSL which certificate to request using Server Name Indication (SNI). This can be done by adding the -servername argument, which tells OpenSSL to negotiate SNI. The command below shows the previous command modified to use SNI.
echo -n | openssl s_client -connect mysite.com:443 -servername mysite.com | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > pem.cert

Find out what version of OpenSSL you're running

Use the version command
openssl version



No comments:

Post a Comment