Private Key
Definition
Private keys are the secret halves of asymmetric key pairs; in TLS, a server uses its private key to prove it owns the public key in its certificate.
A private key is the secret half of an asymmetric key pair such as RSA or ECDSA. Its matching public key is published in the certificate, while the private key stays on the server or in an HSM. In a TLS 1.3 handshake the server signs the handshake transcript with its private key (the CertificateVerify message), proving that it is the legitimate holder of the certificate; the session's encryption keys come from a separate ephemeral key exchange.
Why it matters
Whoever holds the private key can impersonate the site for as long as the certificate is valid and trusted. If a key leaks, you must revoke the certificate and obtain a new one with a new key, because a new certificate for the same key is just as exposed. With forward-secret key exchange (ECDHE), a stolen key does not decrypt previously recorded traffic; with the legacy RSA key exchange, it does. Keep key files readable only by the service account, and out of backups, tickets, chat messages and source control.
Example
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out example.com.key
chmod 600 example.com.key
# check that a key and certificate belong together: the hashes must match
openssl pkey -in example.com.key -pubout | openssl sha256
openssl x509 -in example.com.crt -noout -pubkey | openssl sha256
Common misconceptions
- The CA has a copy of my private key. Not if you generated the CSR yourself; the CA only ever sees the public key.
- Revoking the certificate is enough after a leak. You also need a new key pair.
- A passphrase makes the key file safe anywhere. Servers usually need the key unlocked at startup, so filesystem permissions and access control remain the main protection.