Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Digital signatures and X.509 certificates

Digital signatures provide authenticity, integrity and non-repudiation of messages; X.509 certificates bind public keys to identities within a PKI so parties can trust each other's keys.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Engineers use digital signatures when they need to prove that a message or software came from a particular sender and has not been changed. X.509 certificates are used by TLS/HTTPS, email security (S/MIME), code-signing and many network protocols to deliver and check public keys in a trusted way.

Key ideas

  • Signature algorithms — common ones are RSA signatures, ECDSA, and EdDSA (e.g., Ed25519); DSA is largely deprecated in modern protocols. Each algorithm defines a signing operation using a private key and a verification operation using the matching public key. Modern practice uses padding schemes (e.g. PKCS#1 v1.5 or PSS for RSA) and rejects raw textbook RSA.

    Exact textbook RSA signature (simplified): given RSA key (n, e, d) and message m (represented as an integer or its hash), signature s = m^d mod n and verification checks m ?= s^e mod n. In practice you sign H(m) where H is a cryptographic hash and apply proper padding.

  • X.509 certificate — a structured data object (standard X.509 v3) that binds a public key to a subject name and contains fields such as: version, serialNumber, signatureAlgorithm, issuer (name of signer CA), validity (notBefore, notAfter), subject, subjectPublicKeyInfo, and extensions. Important extensions:

    • BasicConstraints — contains a boolean CA flag and path length constraint (pathLenConstraint). In CA certificates this extension is marked critical; CA:TRUE means the certificate may be used to sign other certificates; pathLenConstraint limits the maximum number of CA certificates that may follow in the chain beneath this certificate.
    • KeyUsage — indicates allowed uses of the key (digitalSignature, keyEncipherment, keyCertSign, etc.). This extension is typically marked critical; validators must enforce permitted uses.
    • ExtendedKeyUsage — refines purposes (TLS server auth, email protection, code signing).
    • SubjectAltName — alternative names (DNS names, IP addresses, emails).
    • SubjectKeyIdentifier — identifies the subject's key; used in chain building.
    • AuthorityKeyIdentifier — links to the issuer's key; used to match the issuer of a certificate.
    • Authority Information Access (AIA) — URLs for OCSP responder and 'CA Issuers' (to fetch issuer certificates).
    • CRL Distribution Points — where to fetch the issuer's CRL.
  • Certificate Authority (CA) — an entity that issues certificates by signing them with its private key. A root CA is self-signed and is a trust anchor; intermediate CAs are signed by a root (or another intermediate) and form chains.

  • Certificate chain (validation path) — a sequence: End-entity certificate <- intermediate CA cert(s) <- root CA cert (trust anchor). To validate a chain: verify each signature using issuer's public key, check that issuer is the signer recorded in the child certificate, confirm each certificate is within its validity period, ensure BasicConstraints and KeyUsage permit signing, enforce any path length constraints, reject any unrecognized critical extensions, and check revocation (CRL or OCSP) and name constraints as applicable.

  • Revocation — certificates may be revoked before expiry. Two common mechanisms are CRL (Certificate Revocation List) — a signed list published by a CA, and OCSP (Online Certificate Status Protocol) — an online query that returns status for a certificate. OCSP stapling is used by servers to supply OCSP responses.

  • Encoding and transport — certificates are commonly encoded in DER (binary) or PEM (Base64 with headers). TLS uses X.509 v3 certificates.

  • Draw a verification diagram for exams: draw three boxes in a vertical chain labeled "Root CA (self-signed)" at top, "Intermediate CA" in middle, "End-entity (server) cert" at bottom. Draw arrows downwards labeled "signedBy". Next to each box write fields to check: serial, issuer, subject, validity, BasicConstraints (CA:TRUE for Root/Intermediate), subjectPublicKeyInfo. To show verification, draw arrows upward showing signature verification using issuer's public key.

Formulas

s = Sign(sk, H(m)) — signature generation; s is signature, sk is private signing key, H(m) is message digest of message m. Units: none. Applies to any signature scheme conceptually.

Verify(pk, m, s) ⇒ (H(m) ?= Recover(pk, s)) — conceptual verification: use public key pk to recover value from signature s and compare to computed digest H(m). Units: none. Applies to RSA-like schemes with message recovery; in general, Verify(pk, m, s) returns accept/reject and does not recover H(m) (e.g., ECDSA/DSA).

For RSA (textbook, simplified):

s = H(m)^d mod n — sign using private exponent d and modulus n. Symbols: s signature (integer), H(m) integer representation of hash, d private exponent (integer), n modulus (integer). Units: none. Applies for RSA-type signatures when using integer representative.

v = s^e mod n — verification; check v == H(m). Symbols: v recovered value (integer), e public exponent, other symbols as above.

Notes: real implementations use padding (e.g. RSA-PSS) and byte-level encodings; do not use textbook RSA in real systems.

Worked examples

Example 1 — small RSA signature (exam-style numeric demonstration)

Data and steps (use small primes so modular arithmetic fits on paper):

  1. Choose primes p = 7 and q = 11. Compute n = p · q = 77 and φ(n) = (p − 1)(q − 1) = 6 · 10 = 60.
  2. Choose public exponent e = 7 (must satisfy gcd(e, φ(n)) = 1). Compute private exponent d such that e · d ≡ 1 (mod φ(n)). Here 7 · 43 = 301 ≡ 1 (mod 60), so d = 43.
  3. Let message representative be m = 13 (in practice H(m) would be used). Sign: s = m^d mod n = 13^43 mod 77. Compute by repeated squaring (show steps in exam):
    • 13^2 mod 77 = 15
    • 13^4 mod 77 = 71
    • 13^8 mod 77 = 36
    • 13^16 mod 77 = 64
    • 13^32 mod 77 = 15 Combine powers: 13^43 = 13^(32+8+2+1). Multiply residues: 15·36·15·13 ≡ 41 (mod 77). So s = 41 (bold answer).
  4. Verify: compute v = s^e mod n = 41^7 mod 77:
    • 41^2 mod 77 = 64
    • 41^4 mod 77 = 15
    • 41^7 = 41^(4+2+1) => 15·64·41 ≡ 13 (mod 77) Recovery equals original m, so signature verifies. Final answer: s = 41, verification gives m = 13.

Example 2 — certificate chain validation (algorithmic trace expected in exams)

Given: three certificates A (root, self-signed), B (intermediate, issuer A), C (server, issuer B). Steps to validate C for TLS:

  1. Check local trust store contains A (root) and treat A as trust anchor.
  2. Verify signature on B using A's public key: parse B, confirm B.issuer matches A.subject, compute signature verification operation using A.publicKey over B.tbsCertificate. If present, ensure B.authorityKeyIdentifier matches A.subjectKeyIdentifier. If signature fails, stop (invalid).
  3. Verify B has BasicConstraints CA:TRUE and KeyUsage includes keyCertSign; enforce pathLenConstraint if present. If not, stop (invalid).
  4. Verify signature on C using B.publicKey; confirm C.issuer matches B.subject. If signature fails, stop.
  5. Check C validity dates: notBefore <= currentDate <= notAfter. If outside, fail.
  6. Check C KeyUsage/ExtendedKeyUsage permit server authentication and the presented name matches SubjectAltName/DNS name (CN fallback is deprecated; use SAN).
  7. Check revocation status for C (OCSP or CRL) and optionally for B. If revoked, fail.
  8. If all checks pass, accept C's public key for the intended use.

In exams, write these steps and indicate which field you inspect at each step.

Common mistakes

  • Forgetting to check certificate revocation or only checking signatures and dates; a revoked cert must be rejected.
  • Failing to check BasicConstraints and KeyUsage when validating intermediate CA certificates (accepting an end-entity cert as CA is a serious error).
  • Trusting any self-signed certificate without it being a configured trust anchor.
  • Using obsolete hash algorithms (MD5, SHA-1) without noting they are deprecated for signatures.
  • Not describing or drawing the chain of trust in answers when asked for verification diagrams.
  • Reusing or biasing the per-message nonce k in ECDSA/DSA (or failing to generate it deterministically per RFC 6979) leaks the private key.

For your exam

Question types you will see: definitions (define digital signature, define X.509), short notes (properties of signatures, explain CA), derivations (show RSA signing and verification), numericals (small RSA key example), trace/algorithm (certificate validation steps), and diagrams (draw chain of trust and label checks).

What a full-marks answer includes:

  • For definitions: clear bolded term and concise properties (authenticity, integrity, non-repudiation). For X.509 include list of main fields and at least two important extensions.
  • For derivation/numeric RSA question: show p, q, n, φ(n), choose e, compute d (show modular inverse), compute signature with modular exponentiation steps, show verification steps and final numeric result.
  • For certificate validation: draw chain, list checks in order (signature, validity, BasicConstraints/KeyUsage, name checks, revocation), and mention trust anchor.
  • For protocol questions: mention encoding (DER/PEM), common algorithms (RSA, ECDSA) and modern recommendations (use SHA-256+, RSA-PSS or ECDSA rather than raw RSA).

Quick check

  1. What are the three main security properties of a digital signature?
  2. Name two important X.509 v3 extensions and state their purpose briefly.
  3. In RSA signatures, what is the verification equation (textbook simplified form)?

Answers: 1) Authenticity, Integrity, Non-repudiation. 2) BasicConstraints (tells if cert may act as CA), KeyUsage (limits allowed uses of key, e.g. digitalSignature, keyCertSign). 3) v = s^e mod n, check v == H(m).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?