OpenSSL cheat sheet

Key generation

Note on key parts

The "public" and the "private" key do not form a a relationship of reciprocally needy parts. That is, the possessor of the private key does not need the public key to perform operations. The public key is a subset of the private key, and the public key can always be regenerated from the private key:

25519 who?

(Thanks StackExchange)

S/MIME cert generation

Case against using `openssl ca`

With the default openssl.cnf, openssl ca expects a certain directory structure (./demoCA/newcerts etc.) as it will auto-track serial number generation and indices. Below, we will look at manually managing absolutely every aspect without requiring any particular path. For absolutely quick-and-dirty CAs, all of the indexing can be ignored.

One-step generation of CA/self-signed certificate

Multi-step generation of CA/self-signed certificate

  1. openssl req -nodes -out myca.req -newkey ed25519 -subj /O=CA -addext basicConstraints=critical,CA:true -addext nsCertType=sslCA,emailCA
  2. openssl x509 -req -in myca.req -signkey myca.key -days 365 -copy_extensions copy -set_serial 1 -out myca.pem

Curious looking invocations

Generation of a CA-capable server certificate from Root CA

Generation of a client certificate tied to the server

System placement

On SUSE and/or where the ca-certificates package is installed, certificate files that should be globally available are to be copied into /etc/pki/trust/anchors (and running update-ca-certificates).