Signature terminology: “encrypt with the private key” is a simplified textbook analogy for some RSA constructions. In practice, signatures use a defined signing and verification algorithm with proper encoding; verification does not decrypt an arbitrary certificate or message.
Digital Signature
A digital signature is a cryptographic method that allows the recipient of a message to verify that it was sent by a specific sender, ensuring that the sender cannot deny having sent the message.
Signing:
Decryption:
Guarantees:
- Authenticity: digital signature verifies that message truly came from claimed sender.
- Integrity: ensures that the content of message hasn’t been altered.
- Non-repudiation: Sender cannot deny having sent the signed message.

Algorithm
- Sender generates key pair (public private)
- Sender computes hash of message
then signs the hash output using private key to generate signature - Sender sends original message with signature to receiver
- Receiver computes hash of original message and generates the digital signature using Senders public key
- If both Digital signature matches, Signature is valid
Man in the middle attack
Intercepting public key exchange between two parties. The attacker can eavesdrop using forged keys and manipulate the messages while pretending to be each party.


Process
- B sends message to A. Instead of encrypting it with A's public key directly, B encrypts using the interceptor C's public key, believing it is A's key.
- C intercepts the message and decrypts it using their private key, allowing them to read the content of the message.
- C re-encrypts the message using A's public key (the real public key) and sends it to A.
Key Fingerprints:
Generated by applying a hash function to public key, producing a shorter string that is easier to share and compare.
When two parties communicate securely, they can share their public keys along with their fingerprints to combat MITM.
The recipient can compare the received fingerprint with a previously known or trusted fingerprint for the sender’s public key.
If attacker attempts to intercept the communication and replace public key with their own, the fingerprint will not match. This mismatch indicates that the key has been tampered with.
Why digital certificates when we have digital signatures?
- 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.
Public Key certificate (Digital certificate)
A type of Digital Certificate that uses a Digital signature to bind a public key to an identity. Certificate verifies that a public key truly belongs to the claimed individual or organization.
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

Most popular Models to Create Digital Certificates:
- Public Key Infrastructure (PKI) model: Signature on the certificate comes from a CA
- Web of Trust model: Signatures come from users (self-signed certificates) or from other users(endorsements)
- Blockchain-based model
Content of a Digital Certificate
| Content | Description |
| Serial Number | Uniquely identifies the certificate. |
| Subject | Identifies the person associated with the certificate. |
| Signature Algorithm | Algorithm used to create the digital signature. |
| Signature | Actual signature to verify that it came from the issuer. |
| Issuer | Entity that issued the certificate. |
| Valid-From | Date the certificate becomes valid. |
| Valid-To | Expiration date of the certificate. |
| Key-Usage | Specifies the purpose of the public key |
| Public Key | The public key associated with the certificate. |
| Thumbprint Algorithm | The hashing algorithm used for the certificate. |
| Thumbprint | The hash representing an abbreviated form of the certificate. |
Vendor defined classes
Categories of digital certificates created by certificate authorities (CAs) based on specific criteria, use cases. Required for security and compliance.
| Class | Description |
| 1 | For individuals, primarily for email. |
| 2 | For organizations, requiring proof of identity. |
| 3 | For servers and software signing, with independent verification. |
| 4 | For online business transactions between companies. |
| 5 | For private organizations or governmental security. |
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): Issues and signs certificates, establishing trust in identities.
- Validation Authority (VA): Verifies identities and authorizes requests before passing them to the CA for certificate issuance. Ensures that user identities are unique within the CA's domain, providing verification on behalf of the CA.
- Registration Authority (RA): Checks the validity of certificates, ensuring they’re still trustworthy and not revoked. Handles the registration and issuance of digital certificates, ensuring non-repudiation by linking public keys to individuals securely.
Simple explanation
- Certification Authority (CA): The teacher while giving badges ensures that badges match the kids' names. For example, the teacher confirms that Tommy's badge says "Tommy"
- Validation Authority (VA): The helper who checks that every kid in the playground has a unique badge, ensuring no two badges have the same name, like making sure there’s only one "Tommy"
- Registration Authority (RA): The person who helps new kids get their badges. They assist with filling out information and ensure that each badge is safe and correctly assigned.