OpenSSL 3 · Certificates

Create a self-signed certificate

Create a key and certificate valid for a year, for testing only.

openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365 -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost,IP:127.0.0.1"

Caution: Browsers don't trust self-signed certificates. Use them only for local development.

Official OpenSSL 3 documentation

More certificates commands

All certificates commands · OpenSSL 3 cheatsheet

Was this page helpful?