Skip to content

Instantly share code, notes, and snippets.

@Youka
Created November 30, 2024 02:24
Show Gist options
  • Save Youka/5b90247a53633d924930845d0adff395 to your computer and use it in GitHub Desktop.
Save Youka/5b90247a53633d924930845d0adff395 to your computer and use it in GitHub Desktop.
Description for self-signed-certificate creation & inspection.

Self signed certificate

Encrypted connections require a certificate + private key.
This little guide shows how to create & inspect those files.

Requirements

Encryption tool OpenSSL is all we need.

Creation

Run command:

openssl req -x509 -newkey rsa:2048 -days 36500 -subj /C=US/O=local/CN=localhost -nodes -out cert.crt -keyout cert.key

On Windows the subject gets rejected because of implicit path substitution -> escape by prepending /?=

New files cert.crt (=certificate) and cert.key (=private key) were created in current directory.

Inspection

Run command:

openssl x509 -noout -text -in cert.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment