Computer Science Assignment Help for CS, IT and AI Students
Chat on WhatsApp
Technical Case Study

Double Ratchet Algorithm and Digital Signature Verification Using GPG

Cryptography
Double Ratchet & GPG Signatures
Assignment requirements (Questions 2 and 3)

Question 2 — End-to-End Encryption
10 points | Approximately 400 words

The Double Ratchet Algorithm is a cryptographic protocol designed for secure end-to-end encryption (E2EE) in instant messaging. The assignment describes its implementation in modern messaging applications, including Facebook Messenger, Google Messages, Skype, WhatsApp and Signal.

a) Describe the architecture and design of the Double Ratchet Algorithm. Explain how message keys are derived and applied for encryption and decryption during message exchange between two users.

Your answer must include:

* Descriptive text.
* One diagram clearly illustrating all ratchets, key derivation processes, and the steps involved in data encryption and decryption.

b) Discuss how the Double Ratchet Algorithm ensures:

* Forward secrecy.
* Post-compromise security.

Reference supplied in the assignment:
Trevor Perrin and Moxie Marlinspike. “The Double Ratchet Algorithm.” GitHub Wiki 112 (2016).

⸻

Question 3 — File Integrity and Authenticity Assessment
10 points | Approximately 400 words

You are working as a cybersecurity analyst for an organisation that receives product information from an external supplier. The organisation has received three different versions of a product information file:

* product_1.txt
* product_2.txt
* product_3.txt

The organisation does not know which of these files is the original file provided by the supplier.

The supplier has provided the following files through a trusted channel:

* product.txt.sig — the digital signature for the product file.
* supplier_public_key.asc — the supplier’s public key.

All files are provided in the compressed archive Files_assignment_2.zip.

a) Analyse all three product files and determine which file or files, if any, are authentic.

You may use any of the following tools, where appropriate:

* HashCalc
* Kleopatra
* Nmap
* John the Ripper

Provide a clear screenshot of the authenticity analysis for each file and briefly explain your results.

b) Explain the difference between signature validity and key trust

Question 2 — End-to-End Encryption

Topic: Double Ratchet Algorithm  |  Reference: Perrin & Marlinspike, "The Double Ratchet Algorithm," 2016

a) Architecture and Design of the Double Ratchet Algorithm

The Double Ratchet Algorithm is what apps like Signal, WhatsApp, and Facebook Messenger use for end-to-end encryption. The main idea is simple: every single message gets its own unique key. It does this by combining two ratchets.

1. Diffie-Hellman (DH) Ratchet

This runs whenever you receive a new DH public key from the other person. It does a DH exchange between your current private key and their new public key. The result goes into a KDF which makes a new Root Key (RK) and Chain Key (CK). You also make a fresh DH key pair for your next sending chain.

2. Symmetric-Key Ratchet

This runs for every message inside a chain. It takes the current Chain Key and uses a KDF to create a Message Key (MK) plus the next Chain Key. The Message Key encrypts or decrypts just one message, then gets deleted right away.

How messages flow (Alice → Bob)

Alice uses her sending chain key to make a message key, encrypts her plaintext, and sends the ciphertext with her current DH public key. Bob receives it, does a DH ratchet step with his private key and Alice's public key to get the same root key and a new receiving chain key, then uses his symmetric ratchet to derive the message key and decrypt.

Diagram

double ratchet diagram

b) Security Properties

Forward Secrecy

This means if an attacker steals your current keys, they still cannot read old messages. The symmetric ratchet gives this because each message key is derived and then deleted immediately. Since the KDF is one-way, you cannot reverse it. Old DH private keys are also deleted. So even if a device is compromised today, old conversations remain safe.

Post-Compromise Security

This is the self-healing property. If an attacker compromises the current state, the session recovers once a new DH exchange happens. When one party sends a message with a new DH public key, a fresh DH secret is computed. The attacker does not have the new private keys, so they cannot compute this secret. All future messages become secure again. This is the major advantage over just using a symmetric ratchet alone.

Question 3 — Digital Signature Analysis

Topic: Verifying product files with GPG  |  Tool: GPG (Command Line)

a) Authenticity Analysis of Product Files

I need to find out which of the three product files is the real one from the supplier. The supplier gave us a signature file (product.txt.sig) and their public key (supplier_public_key.asc). I used GPG on the command line to check each file.

Step 1 — Import the Supplier's Public Key

First I imported the public key into my GPG keyring:

gpg --import supplier_public_key.asc

Output:

gpg import public key

I confirmed the key was imported:

gpg --list-keys
gpg list keys

Result: INVALID

Step 2 — Verify product_1.txt

gpg --verify product.txt.sig product_1.txt

Output:

gpg verify product 1

Result: INVALID

Step 3 — Verify product_2.txt

gpg --verify product.txt.sig product_2.txt

Output:

gpg verify product 2

Step 4 — Verify product_3.txt

gpg --verify product.txt.sig product_3.txt

Output:

gpg verify product 3

Result: VALID

Summary Table

FileProduct NameStatus
product_1.txtSecurity Scanner 1.2.335INVALID
product_2.txtSecurity Scanner 1.2.335INVALID
product_3.txtSecurity Scanner 1.5.335VALID

What does this mean?

product_3.txt is the real one. The signature matches perfectly, so nobody changed the file after the supplier signed it. It correctly shows "Security Scanner 1.5.335" and the Additional field has Ft3wMlkkdLbYq.

product_1.txt has an older product name — it says "Security Scanner 1.2.335" instead of "1.5.335" and the Additional field has Fz3wMlkkdLbYq instead of Ft3wMlkkdLbYq. The signature fails, which means the file was modified after signing. It is not authentic.

product_2.txt looks similar to product_1.txt — it also shows "Security Scanner 1.2.335" with the Additional field Fz3wMlkkdLbYq. The signature fails here too. Even though it may look like a valid product file, the hash is different from the signed original, so GPG reports a BAD signature. It is not authentic.

Conclusion: Only product_3.txt is authentic. The other two have been modified and should not be trusted.

b) Signature Validity vs Key Trust

These two sound similar but they are actually totally different.

Signature Validity

This is just math. It asks: "Does this signature match this file using this public key?"

If yes, the file has not been changed since signing, and the signature was made with the matching private key.

A "Good signature" just means the cryptography checks out. That is it.

In our case, product_3.txt had a good signature. product_1 and product_2 did not.

Key Trust

This is about identity. It asks: "Is this public key really owned by who it claims to be?"

Just because a signature is valid does not mean the key actually belongs to the supplier. Anyone could make a key pair, sign a file, and pretend to be "ACS Pty Ltd".

Trust is built by:

Checking the fingerprint through a separate channel (like calling them)

Having others you trust sign the key (web of trust)

Using a certificate authority

During verification, GPG warned us: "This key is not certified with a trusted signature!" — meaning the key works, but we have not confirmed it is really ACS.

Simple way to remember:
Validity = "The math works"
Trust = "I believe this key is really from who it says"

So you could have a file with a valid signature but from an untrusted key. In that case, you should verify the key's fingerprint through another trusted method before trusting the file. In our assignment, product_3.txt is valid, but we would still want to confirm the key's fingerprint with the supplier directly to be completely certain.

WhatsApp