liveBook · Manning

Self-signed certificate

As explained in Software Security for Developers

A self-signed certificate is a certificate whose signature is created using the private key corresponding to its own public key rather than a separate certificate authority's key.

A self-signed certificate is an X.509 certificate whose subject and issuer are the same: it is signed with the private key corresponding to its own public key rather than by a separate certificate authority (CA). It is easy to create, but it is not part of a trusted certificate chain, so browsers and operating systems do not trust it automatically. section 9.1.4 section 9.4

Consider a checkout microservice calling an inventory microservice over HTTPS inside one company. A self-signed certificate may avoid a public CA, but clients commonly show warnings or reject it. Disabling validation with curl, kubectl, or application code removes the protection TLS is meant to provide and can allow insecure behavior to reach production. section 9.1.4 section 9.2

Creating one with OpenSSL

A certificate can be created from a certificate-signing request and its existing private key: openssl x509 -req -days 365 -in request.csr -signkey private_key.pem -out certificate.pem. The command produces a certificate, but clients still need an explicit trust arrangement before accepting it. section 9.1.4

Prefer these patterns when choosing between convenience and trust:

  • Use a self-signed certificate only for limited testing where trust is configured deliberately. section 9.3
  • For local development, create a personal or private CA, install its CA certificate in the operating system trust store, and issue development certificates from it. section 9.2 section 9.4
  • Do not solve certificate errors by turning off validation; preserve the same HTTPS and TLS behavior used in production. section 9.2 section 9.3
$ openssl x509 -req -days 365 -in request.csr -signkey private_key.pem 
-out certificate.pem

View the complete OpenSSL command used to sign a certificate with its own private key. section 9.1.4

How Software Security for Developers covers it

How deep it goes
Explains the subject-issuer relationship, OpenSSL creation, trust-chain failure, validation risks, and the private-CA alternative.
Examples
Uses an internal checkout-inventory call, an OpenSSL signing command, browser warnings, and local development with a personal CA.
What it assumes
Assumes basic HTTPS and certificates, while defining CAs, trust chains, certificate signing requests, and local trust from practical examples.
What you can do after
Apply OpenSSL to create a certificate, diagnose validation failures, and configure a trusted local CA instead of disabling validation.
How it connects
Connects self-signed certificates with X.509 certificates, certificate authorities, certificate chains, TLS, HTTPS, and certificate validation.

Also explained in

Compare how 4 books explain self-signed certificate →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.