01 / 20

Digital Signatures
& Integrity

Learn how digital signatures prove authorship and how integrity verification ensures data hasn't been tampered with: the mathematical trust layer of the internet.

Cyber Security

What Is Data Integrity?

Data integrity means that information has not been altered in transit or storage. When you download a file, send a message, or receive a contract, you need assurance that the content is exactly what the sender intended: not a single bit changed.

What Is a Digital Signature?

A digital signature is a cryptographic mechanism that binds a message to an identity. It provides three guarantees:

Authentication
Proves who created or approved the message.
Integrity
Confirms the message has not been altered since signing.
Non-repudiation
The signer cannot deny having signed the message.

Why Does This Matter?

Every time you visit a website over HTTPS, install software, or sign a PDF, digital signatures are at work behind the scenes. Without them:

1
Attackers could impersonate banks and steal credentials via forged websites.
2
Malware could masquerade as legitimate updates from trusted software vendors.
3
Contracts could be forged with no way to prove who actually agreed to the terms.

Hash Functions: The Core Building Block

A cryptographic hash function takes any input and produces a fixed-size output called a digest. The function \( H(m) \) has critical properties:

1
Deterministic: The same input \( m \) always yields the same hash \( H(m) \).
2
One-way: Given \( H(m) \), it is computationally infeasible to recover \( m \).
3
Collision-resistant: It is extremely hard to find two different inputs \( m_1 \neq m_2 \) where \( H(m_1) = H(m_2) \).
4
Avalanche effect: A tiny change in input produces a completely different hash output.

How Hashing Works

Message Hash Function H(m) Fixed-Size Digest Any size input e.g., 256 bits "Hello" → 185f8db32271fe25f561a6fc938b2e26...

The Signing Process

Message H(m) = digest Encrypt Digest with Private Key Private Key (secret) Signature Sent Together Message + Signature Step 1 Step 2 Step 3 Step 4

The Verification Process

Message Signature H(m) = digest' Decrypt with Public Key Public Key (open) = digest Compare digest' = digest ? ✓ Valid ✕ Invalid Path A Path B

Signature vs Encryption

Digital Signature Encryption
Purpose Prove who sent it and it's unaltered Keep the content secret
Key used to create Private key (sender) Public key (recipient)
Key used to verify/decrypt Public key (anyone) Private key (recipient)
Provides confidentiality? No Yes
Provides authentication? Yes No

Private vs Public Keys

Private Key
Kept secret by the owner. Used to sign messages. If compromised, all signatures are untrustworthy.
Public Key
Shared openly with everyone. Used to verify signatures. Anyone can confirm a signature is valid.

How to Verify a Signature

1
Receive the original message and the attached digital signature.
2
Obtain the sender's public key from a trusted source (e.g., a certificate authority).
3
Hash the received message using the same algorithm: compute \( H(m) \).
4
Decrypt the signature using the sender's public key to recover the original digest.
5
Compare the two digests. If they match, the signature is ✓ valid. If not, the data was ✕ tampered with.

Example: Email Signing

Alice wants to send Bob a signed email saying "Transfer $500 to account #1234."

1
Alice computes: \( H(\text{"Transfer \$500 to account \#1234"}) = \texttt{a3f7...} \)
2
Alice encrypts the digest with her private key: \( S = E_{K_{\text{priv}}}(\texttt{a3f7...}) \)
3
Alice sends the message + signature \( S \) to Bob.
4
Bob hashes the message himself and decrypts \( S \) with Alice's public key.
5
Both digests match → ✓ Bob trusts the email is from Alice and unaltered.

Example: Software Downloads

You download a file update.exe from a vendor's website. They also publish its SHA-256 checksum and a digital signature.

Vendor Website Published: 9c3e... Your Computer download Computed: 9c3e... Match? ✓ If file was tampered: Computed: b71a... ≠ 9c3e... Reject ✕

Example: HTTPS Certificates

When you visit https://bank.com, your browser verifies the site's digital certificate:

1
The server presents a certificate containing its public key, signed by a Certificate Authority (CA).
2
Your browser already trusts the CA's public key (pre-installed in the OS/browser).
3
The browser verifies the CA's digital signature on the certificate.
4
If valid → ✓ padlock icon appears. If not → ✕ warning page.

Common Mistakes

✕ Confusing signing with encrypting
Signing uses your private key to prove identity. Encrypting uses the recipient's public key for secrecy. They serve different purposes.
✕ Thinking signatures hide data
A digital signature does not encrypt the message. Anyone can read the message: the signature only proves who sent it and that it's unaltered.
✕ Using broken hash algorithms
MD5 and SHA-1 have known collision attacks. Always use SHA-256 or SHA-3. An insecure hash undermines the entire signature scheme.

Summary of Key Concepts

Concept What It Does Key Tool
Hash Function Creates a unique fingerprint of data SHA-256, SHA-3
Digital Signature Proves authorship + integrity Private key + hash
Verification Confirms signature is valid Public key + hash comparison
Certificate Authority Vouches for a public key's owner Signed certificates
Non-repudiation Signer cannot deny having signed Private key uniqueness

Question 1 of 5

Which key does the sender use to create a digital signature?

Question 2 of 5

What does a cryptographic hash function guarantee about its output?

Question 3 of 5

During signature verification, the receiver decrypts the signature using the sender's public key and then:

Question 4 of 5

Which of the following is NOT a property provided by digital signatures?

Question 5 of 5

Why are MD5 and SHA-1 considered unsuitable for digital signatures today?