Certificate terminology: the issuer signs certificate data, not the CSR itself. A registration authority performs identity checks; a validation service checks certificate status. A self-signature can be checked mathematically, but trust in that key must come from a separate trusted channel. Modern TLS hostname verification uses subjectAltName, rather than the legacy Common Name descriptions in these notes. DV, OV, and EV are certificate validation categories, not different digital-signature algorithms.
TLS service identity: RFC 9525
Public Key Infrastructure (PKI) (brief discussion)
Is a Certification Management Model that includes the hardware, software, policies, and procedures necessary to create, manage, and distribute digital certificates.
Uses public-key cryptography and digital certificates to establish trust among users.
PKI creates a chain of trust through a hierarchical structure or a web of trust, ensuring that certificates are valid and reliable.
Architectures:
Various Ways to structure PKI for managing certificates and cryptography.
- Hierarchical PKI: Follows standards like X.509.
- Web of Trust: Utilizes systems like PGP software
Roles in PKI:
Different entities in PKI handle various aspects of digital certificate management:
- Certification Authority (CA): A trusted entity that binds public keys to user identities.
- Validation Authority (VA): Ensures that user identities are unique within the CA's domain, providing verification on behalf of the CA.
- Registration Authority (RA): Handles the registration and issuance of digital certificates, ensuring non-repudiation by linking public keys to individuals securely.
Why digital certificates when we have digital signatures? (Again)
- Digital signatures verify authenticity of message, but do not establish trust in the owner of message. CAs verifies the owner of the message
- In Digital signatures we have to manually distribute the public key securely. Digital certificates simplifies key distribution
- Receiver has to manually verify the signature which is cumbersome. Digital certificates standardizes the format that automates signature verification
MITM is still possible on communication with digital signatures. If Attacker intercepts the public key of the sender and replaces it with their own before recipient receives it, they can effectively impersonate the sender.
Solution: Validate and sign public keys by a third party (e.g CA) create a trust model that establishes a link between a user’s identity and their public key.
Algorithm:
- A generates a key pair
- A creates a Certificate signing request (CSR) to Certificate Authority (CA)
- CA is responsible for verifying the identity of A
- If CA verifies A's identity, it signs CSR digital certificate using CA's private key
- Signed digital certificate sent back to A, A distributes it on public repos for others to verify him
- B can verify if A is A by verifying digital signature by decrypting certificate using CA's public key

X.509
Most widely accepted format for public-key certificates
Introduced 1988 by ITU, still the most popular certificate format 🔥
Used in most network applications
Format:
Reading an X.509 certificate
Certificate:
Data:
Serial Number:
2c:d1:95:10:54:37:d0:de:4a:39:20:05:6a:f6:c2:7f
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=US, O=Symantec Corporation,
OU=Symantec Trust Network,
CN=Symantec Class 3 EV SSL CA - G3
Validity:
Not Before: Feb 2 00:00:00 2016 GMT
Not After : Oct 30 23:59:59 2017 GMT
Subject: 1.3.6.1.4.1.311.60.2.1.3=US/
1.3.6.1.4.1.311.60.2.1.2=Delaware/
businessCategory=Private Organization/
serialNumber=3014267, C=US/
postalCode=95131-2021, ST=California,
L=San Jose/street=2211 N 1st St,
O=PayPal, Inc., OU=CDN Support, CN=www.paypal.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:da:43:c8:b3:a6:33:5d:83:c0:63:14:47:fd:6b:22:bd:
bf:4e:a7:43:11:55:eb:20:8b:e4:61:13:ee:de:fe:c6:e2:
... (omitted in the source) ...
7a:15:00:c5:01:69:b5:10:16:a5:85:f8:fd:07:84:9a:c9:
Exponent: 65537 (0x10001)
Signature Algorithm: sha256WithRSAEncryption
4b:a9:64:20:cc:77:0b:30:ab:69:50:d3:7f:de:dc:7c:e2:fb:93:84:fd:
78:a7:06:e8:14:03:99:c0:e4:4a:ef:c3:5d:15:2a:81:a1:b9:ff:dc:3a:
... (omitted in the source) ...
fb:00:3e:7d:6a:de:cb:9f:ff:ef:8c:65:35:e4:22:b5:88:b2:48:32:1e:Issuer identifies the CA (Symantec in this historical example); Subject identifies the certificate owner (PayPal); Subject Public Key Info contains the public key; the final signature is the CA’s signature. This is an expired example for reading the format, not a current certificate.
Certificate Authority(CA)
A trusted entity that binds public keys to user identities.
Core functions:
- Verifying Identity: Checks that person applying for the certificate is the true owner of the identity they claim.
- Issuing Certificates: After verifying identity, CA issues digital certificate, digitally signing it with its private key. The signature can be verified using the CA public key, making unauthorized alterations detectable.
How to verify self-signed Certificates?
Self-signed certificate is signed by entity who itself launched the Certificate signing request (CSR). That Entity signed the certificate without being verified
The self-signature can be verified, but it does not independently establish trust in the signer. If certificate comes built-in inside OS you trust, trust the certificate. Certain software apps include self-signed certificate in installation package, if software comes from reputable developer, trust the self-signed certificate
Deploying certificate for securing web servers
Assuming you already have received signed certificate in .crt format
Now how to configure web server to use that certificate
- Configure server to use installed certificate using commands
- Enable HTTPS by modifying firewall settings, certificate is setted up
- Now Customer's browser can check the server’s certificate using the CA's public key. If their browser does not recognizes the CA, it may give a warning unless the CA's certificate is manually added to the browser's trusted list. Public keys of root CAs are pre-installed in the OS and browsers
Hierarchy in PKI:
In large PKI systems, Root CAs and Intermediate CAs form a hierarchy:
- Root CA: Is at the top of PKI hierarchy. Is a trusted entity that issues certificates for Intermediate CAs. root CA’s public key is also stored in an X.509 certificate and is self-signed.
- Intermediate CAs: Issued certificates by Root CAs, Intermediate CAs can issue certificates for entities like websites. This chain of trust is verified from the server's certificate up to a trusted Root CA.
e.g. If PayPal has a certificate signed by an Intermediate CA, the browser will check each certificate up the chain until it reaches a trusted Root CA, verifying the site’s authenticity.

How PKI defeats MITM
All possible moves MITM attacker can play and how PKI defeats it:
- Attacker Forwards the Authentic Certificate:
- C intercepts communication between A and B and forwards the authentic certificate issued to example B
- A's browser uses B’s public key to establish an encrypted session. A sends encrypted secret to B using this public key, and only B (with its private key) can decrypt it.
- C lacks the private key, so he can’t tamper with the communication.
- MITM Fails
- Attacker Creates a Fake Certificate:
- C attempts to create a fraudulent certificate pretending to be B.
- C replaces B’s public key with his own. and asks a trusted CA to sign the certificate.
- CA rejects the request because C does not own B.com. C then creates a self-signed certificate instead.
- A's browser detects that the certificate is not from a trusted CA, raising a security warning.
- MITM Fails, A terminates connection
- Attacker Sends His Own Certificate:
- C intercepts the connection and presents a valid certificate, but it’s registered for a different domain (C.com) rather than B.com.
- A’s browser verifies the identity in the certificate’s subject field. It finds a mismatch (C.com ≠ B.com).
- MITM Fails, browser terminates connection
- Emulating an MITM Attack with a DNS Attack:
- C attempts a DNS-based MITM attack by altering the /etc/hosts file on A’s machine, mapping B.com to C server’s IP address.
- A’s browser reaches C’s server, which uses C’s certificate with a different domain C.com when expected was B.com.
- Browser detects the mismatch between B.com and the certificate’s common name.
- MITM Fails, browser terminates connection
During the TLS/SSL handshake, the browser validates the certificate and checks that the Subject Alternative Name (SAN; legacy examples use CN) in the certificate matches the server's hostname. Failing to verify CN can lead to security flaws
Browsers Must-do's:
Browsers must do these things to prevent Attacks:
- Must verify the certificate is issued by trusted CA
- Must check if certificate has not been expired
- Must check if domain name (B.com) matches common name in certificate
- Must ensure whole certificate chain is valid and trusted CA
- Must check if digital signature hasn’t been altered by using CA public key
- Must treat self-signed certificates with caution
Man-in-the-Middle (MITM) Proxy Attack
A proxy is an intermediary that forwards client requests to other servers
In this attack, a proxy creates a self-signed CA certificate and installs it on the user's browser. The proxy intercepts HTTPS traffic, issuing fake certificates that the browser trusts due to the installed proxy CA certificate, enabling MITM.
Attacks on Digital Signatures
- CAs verify the relationship between an applicant and the certificate's subject information. If compromised Comodo Breach (2011), attackers can obtain fraudulent certificates.
- If a CA’s private key is stolen, attackers can create fake certificates, DigiNotar Breach (2011).
- Cryptographic weaknesses, such as collision vulnerabilities in hash functions (e.g., MD5 and SHA-1), can be exploited, prompting stronger algorithms like SHA-256.
- Software should verify that the server matches the user’s intended destination by comparing the CN with user expectations. Flaws in this process can lead to security risks.
- Attackers can use Unicode characters to make fake domains appear like real ones, exploiting domain name display issues. e.g. Several browsers do not display the domain name correctly if name contains Unicode. xn—80ak6aa92e.com (using Cyrillic) could look like apple.com in the browser, misleading users.
Types of Digital Signature
- Domain Validated Certificates (DV):
CAs verify only domain ownership, often through WHOIS or email validation. DV is the most common type - Organization Validated Certificates (OV):
Requires additional validation, including organizational identity, address, and ownership details. Such as - Domain control validation
- Verify applicant's identity, address, and link to organization
- Confirm organization’s address and WHOIS record
- Callback to organization’s verified phone number
- Extended Validated Certificates (EV):
Highest level of verification, including legal documents proving the organization’s existence and authority. EV certificates are more costly but provide greater trust.
- Domain control validation
- Confirm individual’s identity, authority, and link
- Verify organization’s address, phone, operational existence, and legal status

Historical browser UI examples: these address-bar designs illustrate the original notes, not current browser appearance.