keepcalculator

06 Numbers and Powers

Public Key Certificate: Clear X.509 Definition

Card No. 06·82910 · Updated · Standard formula, shown below

A public key certificate is a digital document that binds a public key to an identity, such as a person, server, or organization, and is signed by a trusted authority. In practice, most public key certificates follow the X.509 standard, which defines the exact fields, encoding rules, and validation procedures. This article explains what an X.509 public key certificate is, how it works, how to choose one, common problems, and how it compares to other trust mechanisms.

What Is X.509?

X.509 is an international standard (ITU-T X.509) that defines the format of public key certificates. It was first published in 1988 as part of the X.500 directory services standard. The current version is X.509 v3, which adds extensions for modern uses like subject alternative names and key usage constraints.

An X.509 certificate contains several mandatory fields:

  • Version (v1, v2, or v3)
  • Serial number (unique within the issuing CA)
  • Signature algorithm (e.g., sha256WithRSAEncryption)
  • Issuer (the CA that signed the certificate)
  • Validity period (not before and not after dates)
  • Subject (the entity the certificate is issued to)
  • Subject public key info (the public key and its algorithm)
  • Extensions (v3 only, e.g., Basic Constraints, Key Usage, Subject Alternative Name)

The signature is computed over the certificate’s content using the issuer’s private key. Anyone can verify the signature using the issuer’s public key, which is itself often in a certificate.

How Does a Public Key Certificate Work?

The core idea is to establish trust in a public key without a direct prior relationship. When you connect to a website using HTTPS, the server sends its certificate. Your browser checks that:

  1. The certificate is not expired.
  2. The hostname matches the Subject Alternative Name.
  3. The certificate is signed by a trusted Certificate Authority (CA).
  4. The CA’s certificate is itself valid and trusted (chain of trust).
  5. The signature is cryptographically valid.

If all checks pass, your browser uses the public key from the certificate to establish a secure session (e.g., via TLS handshake). The private key never leaves the server.

Certificates are also used for email signing (S/MIME), code signing, and client authentication. In each case, the certificate proves that the holder controls the corresponding private key.

How to Choose a Certificate Type

Choosing a certificate depends on your use case. The main types are:

  • Domain Validation (DV): Only verifies domain ownership. Issued quickly, usually free or low cost. Suitable for basic HTTPS.
  • Organization Validation (OV): Verifies the organization’s legal existence and domain ownership. Shows organization name in the certificate. Better for business sites.
  • Extended Validation (EV): Requires the most rigorous vetting, including legal documents and phone verification. Displays the organization name in the browser address bar (though many browsers now show it differently). Used for high-value financial sites.
  • Wildcard: Covers a domain and all its subdomains (e.g., *.example.com).
  • Multi-domain: Covers multiple distinct domain names in one certificate.

For internal use, you can run your own CA (e.g., using OpenSSL) and issue certificates to your devices. That gives you full control but requires you to distribute the CA certificate to all clients.

Common Problems and Misconceptions

One common misconception is that a certificate proves the website is trustworthy or safe. In reality, it only proves that the domain owner controls the private key and that the CA verified some level of identity. A DV certificate can be issued to a malicious domain, so a padlock does not mean the site is safe.

Another frequent issue is certificate expiration. When a certificate expires, clients will reject it, causing service outages. Automated renewal (e.g., using ACME protocol) is the standard solution.

Other problems include:

  • Mismatched hostname: The certificate does not include the exact domain you are using.
  • Broken chain: The server does not send the intermediate CA certificate, so clients cannot verify the chain.
  • Weak key or algorithm: Using SHA-1 or RSA-1024 is now considered insecure and rejected by modern browsers.
  • Revocation not checked: Some clients do not check CRL or OCSP, so a revoked certificate may still be accepted.

Comparison: X.509 vs. Other Trust Models

X.509 is the dominant standard for public key infrastructure (PKI). Alternatives include:

  • PGP (Pretty Good Privacy) / OpenPGP: Uses a web of trust where individuals sign each other’s keys, no central CA. Used for email encryption and software signing.
  • TOFU (Trust On First Use): Used in SSH. The first time you connect, you accept the key; if it changes later, you get a warning. No central authority.
  • DNS-based Authentication of Named Entities (DANE): Uses DNSSEC to publish certificates in DNS records, reducing reliance on CAs.

X.509 is more scalable and widely deployed, but it relies on the trustworthiness of CAs. A compromised CA can issue fraudulent certificates. That is why modern browsers use Certificate Transparency to log all issued certificates publicly.

How to Read a Certificate

You can inspect a certificate in your browser by clicking the padlock icon and viewing the certificate details. In the command line, you can use OpenSSL:

openssl s_client -connect example.com:443 -showcerts

This shows the certificate chain. To view a certificate file:

openssl x509 -in cert.pem -text -noout

Look for the Subject, Issuer, Validity, and Public Key fields. Also check the extensions, especially Key Usage and Extended Key Usage, to see what the certificate is allowed to do.

Cost and Management

Certificate costs vary widely. DV certificates can be free (e.g., Let’s Encrypt), while OV and EV certificates may cost money. The price depends on the CA and the level of validation. For internal use, running your own CA is free in terms of software but requires administrative effort.

Managing certificates involves tracking expiration dates, renewing them, and ensuring the private key is stored securely. Many organizations use certificate lifecycle management tools to automate these tasks.

Safety and Best Practices

To keep your certificates secure:

  • Use at least RSA-2048 or ECDSA P-256 keys.
  • Use strong hash algorithms like SHA-256 or higher.
  • Protect private keys with file permissions and hardware security modules (HSMs) for high-value keys.
  • Implement automated renewal to avoid expiration.
  • Monitor Certificate Transparency logs for unauthorized certificates.
  • Revoke compromised certificates promptly and use OCSP stapling if possible.

Remember that a certificate does not protect you from phishing or malware; it only secures the communication channel. Always verify the identity of the site you are visiting, especially when entering sensitive information.

Frequently Asked Questions

What is the difference between a public key and a private key?

The public key is shared openly and is used to encrypt data or verify signatures. The private key is kept secret and is used to decrypt data or create signatures. In a certificate, the public key is embedded, while the private key remains with the certificate holder.

Can a certificate be used for both encryption and signing?

Yes, but it depends on the Key Usage extension. Some certificates are restricted to one purpose. For example, a TLS server certificate typically has digitalSignature and keyEncipherment, while a code signing certificate only has digitalSignature. It is safer to use separate certificates for different purposes.

Why do certificates expire?

Expiration limits the window in which a compromised key can be used. It also forces periodic re-validation of identity. Short-lived certificates (e.g., 90 days) reduce the impact of a key compromise and encourage automation.

What happens if a CA is compromised?

If a CA is compromised, attackers could issue valid certificates for any domain. Browsers and operating systems can revoke trust in that CA by removing its root certificate. Certificate Transparency helps detect fraudulent issuance, and audits (like WebTrust) are meant to reduce the risk.

Is it safe to use a self-signed certificate?

Self-signed certificates are not trusted by clients unless you manually install them. They are fine for testing or internal use where you control the clients. For public websites, you need a certificate from a trusted CA to avoid browser warnings.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →