Openssl Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 23: Line 23:
==Create a Certificate Signing Request (CSR)==
==Create a Certificate Signing Request (CSR)==


This procedure generates a [[Public_Key_Security#Certificate_Signing_Request_.28CSR.29|Certificate Signing Request (CSR)]] that should be sent to the [[Public_Key_Security#Certificate_Authority_.28CA.29|certificate authority]] for signature. The CSR command (<tt>openssl req<tt>) may use an existing private key, previously generated with openssl , or it can create a new private key.
This procedure generates a [[Public_Key_Security#Certificate_Signing_Request_.28CSR.29|Certificate Signing Request (CSR)]] that should be sent to the [[Public_Key_Security#Certificate_Authority_.28CA.29|certificate authority]] for signature. The CSR command (<tt>openssl req</tt>) may use an existing private key, previously generated with [[#Generate_the_Private_Key|openssl ]], or it can create a new private key.


=Obtain a Server Certificate=
=Obtain a Server Certificate=

Revision as of 03:45, 8 April 2018

External

Internal

Generate a Public/Private Key Pair

Generate the Private Key

This is the procedure to generate a public/private key pair. The keys can be further used to generate digitally signed certificates, or even to configure ssh, though ssh has its own procedure to generate key pairs, which produces equivalent keys in the same PEM format.

openssl genrsa|gendsa -out <keyfile-name>.pem <key-lenght>
openssl genrsa -out test-pk.pem 2048

The command generates a RSA/DSA key of specified length in PEM format.

Generate the Matching Public Key

Generate a Self-Signed Certificate

Create a Certificate Signing Request (CSR)

This procedure generates a Certificate Signing Request (CSR) that should be sent to the certificate authority for signature. The CSR command (openssl req) may use an existing private key, previously generated with openssl , or it can create a new private key.

Obtain a Server Certificate

openssl s_client -connect nexus-cicd.apps.openshift.novaordis.io:443

The response includes the server's certificate:

[...]
Certificate chain
 0 s:/CN=*.apps.openshift.novaordis.io
[...]
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDRTCCAi2gAwIBAgIBEjANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBtvcGVu
[...]
65vqsz8NTtde1vJ5qW31Af0pO9YehiSRfA==
-----END CERTIFICATE-----
subject=/CN=*.apps.openshift.novaordis.io
[...]