openssl req

The OpenSSL command that creates certificate signing requests, and with the -x509 option creates a self-signed certificate instead.

In more detail

You give it a private key (or let it generate one), a subject name and extensions such as subject alternative names, and it writes a request signed with that key. With -x509 it signs the result with the same key to produce a self-signed certificate, which is how a root certificate authority or a quick test certificate is made. It can also print and verify existing requests.

Examples

openssl req -new -key www.key -out www.csr -subj "/CN=www.example.com" -addext "subjectAltName=DNS:www.example.com,DNS:example.com"
openssl req -x509 -key ca.key -out ca.pem -set_serial 1 -subj "/O=Example Corp/CN=Example Corp Root CA"

Related terms

Taught in

References