Latest / CyberCode Academy / Course 17 - Computer Network Security Protocols And Techniques | Episode 5: Digital Trust and Integrity: Hash Functions and Certification
Transcript
- 0:00Speaker 1: Welcome back to the deep dive. Today, we are diving deep,
- 0:03Speaker 1: and I mean really deep, into something that underpins almost
- 0:07Speaker 1: everything we do online, digital trust. We're going to wrestle
- 0:11Speaker 1: with a question that's fundamental to our digital age. How
- 0:15Speaker 1: do we prove that a file hasn't been secretly altered?
- 0:18Speaker 1: And maybe even more importantly, how do we know the
- 0:21Speaker 1: person we're talking to is actually who they say they are?
- 0:25Speaker 2: Right? And that struggle for authenticity. It's this invisible shield
- 0:29Speaker 2: that protects basically all secure transactions. If we can't reliably
- 0:34Speaker 2: prove those two things beta integrity and sender integrity, the
- 0:38Speaker 2: whole system of e commerce, banking, you know, secure digital life,
- 0:43Speaker 2: it just collapses.
- 0:44Speaker 1: So where do we start.
- 0:45Speaker 2: Well, this deep dive is going to focus on two
- 0:47Speaker 2: foundational building blocks. First, hash functions, which are these powerful
- 0:51Speaker 2: tools for data integrity. And second certification authorities, which is
- 0:54Speaker 2: the mechanism that verifies digital identity.
- 0:56Speaker 1: Okay, let's unpack that. Starting with integrity, when you have
- 0:59Speaker 1: a massive file, you can you can't compare it bit
- 1:01Speaker 1: by bit every time to see if it's changed. You
- 1:02Speaker 1: need a shortcut. You need a fingerprint, exactly, a fingerprint
- 1:05Speaker 1: for the data and it doesn't matter if it's a
- 1:07Speaker 1: tiny text message or a huge software update. We need
- 1:10Speaker 1: a unique, fixed length identifier. We call this a message digest,
- 1:15Speaker 1: and it's like.
- 1:15Speaker 2: A cryptographic fingerprint. If you change even one single character
- 1:19Speaker 2: in that original document, the fingerprint changes completely. It's totally different.
- 1:24Speaker 1: This gives us what's called non repudiation.
- 1:26Speaker 2: Right precisely, the message digest tells you instantly, Yep, this
- 1:29Speaker 2: data is exactly what it was when it was signed,
- 1:31Speaker 2: or nope, someone's been tampered with. And our sources detailed
- 1:36Speaker 2: two really significant historical examples of these hash functions. They
- 1:41Speaker 2: laid the groundwork for modern security, even though you know,
- 1:44Speaker 2: we have to be clear, they're showing their age now.
- 1:46Speaker 1: Right, So let's start with the one that really defined
- 1:49Speaker 1: the early Internet MD five.
- 1:51Speaker 2: MD five Yeah, it stands for a Message digest algorithm five.
- 1:54Speaker 2: It used to be everywhere. It's formally detailed in an
- 1:57Speaker 2: old ief document RFC thirteen twenty one, and its main
- 2:01Speaker 2: feature is that it generates a one hundred and twenty
- 2:03Speaker 2: eight bit message digest.
- 2:05Speaker 1: And the process is pretty complex, right, It's not simple.
- 2:08Speaker 2: It's rigorous. There are four distinct steps, but the really
- 2:11Speaker 2: powerful part was that the original message could be any length,
- 2:15Speaker 2: a whole book, whatever, but the output, the digest is
- 2:19Speaker 2: always that fixed short one hundred and twenty eight bits.
- 2:22Speaker 1: And that's the one way street property. Because the input
- 2:24Speaker 1: can be basically infinite, but the output is small and fixed,
- 2:28Speaker 1: it's computationally infeasible to go backwards. You can't reconstruct the
- 2:32Speaker 1: original message just from the digest exactly.
- 2:35Speaker 2: That's the magic trick that makes it so useful. Now
- 2:37Speaker 2: we move on to the next one SAHA one or
- 2:39Speaker 2: secure hash algorithm one. We see an attempt to make
- 2:43Speaker 2: things more secure just by making it bigger.
- 2:46Speaker 1: Okay, so how much bigger are we talking.
- 2:48Speaker 2: It's a US standard from NIST, and it generates a
- 2:51Speaker 2: longer one hundred and sixty bit message digest, and.
- 2:53Speaker 1: A longer digest means the number of possible fingerprints is
- 2:58Speaker 1: exponentially larger, which in theory makes it much harder for
- 3:01Speaker 1: two different documents to accidentally have the same fingerprint in theory.
- 3:05Speaker 2: Yes, but we should pause here for a second. It's
- 3:07Speaker 2: really important for him and listening to understand that we
- 3:10Speaker 2: don't rely on these for high security applications anymore.
- 3:13Speaker 1: Right, This is historical context, foundational but not what your
- 3:17Speaker 1: bank is using today.
- 3:18Speaker 2: Absolutely. The problem we discovered is something called collisions.
- 3:21Speaker 1: A collision that does not sound good, It is very bad.
- 3:24Speaker 2: A collision is when two completely different messages, say a
- 3:27Speaker 2: legitimate contract and a fraudulent one, end up producing the
- 3:31Speaker 2: exact same message, digest the same fingerprint.
- 3:34Speaker 1: Oh wow, So a bad actor could swap a fraudulent
- 3:38Speaker 1: file for a real one and the hash check would
- 3:40Speaker 1: still pass exactly.
- 3:41Speaker 2: And we found that both MD five and SAHA one
- 3:44Speaker 2: are now vulnerable to these collision attacks. That's why modern
- 3:47Speaker 2: standards have moved on to much longer, more robust algorithms
- 3:50Speaker 2: like SAHA two, five, six, or SAHA three. But understanding
- 3:54Speaker 2: how SAHA one worked is key to appreciating why the
- 3:57Speaker 2: new ones are better.
- 3:58Speaker 1: Okay, let's get into that. Then, how did essay try
- 4:00Speaker 1: to create that robust one hundred and sixty bit fingerprint.
- 4:03Speaker 1: The engineering is actually pretty cool.
- 4:05Speaker 2: It's designed to be highly sensitive and cumulative. The process
- 4:09Speaker 2: starts by taking the original message and chopping it up
- 4:11Speaker 2: into these manageable standard sized blocks of five hundred twelve
- 4:14Speaker 2: bits each.
- 4:15Speaker 1: So your giant file just becomes a long chain of
- 4:18Speaker 1: these five hundred and twelve bit chunks.
- 4:19Speaker 2: M M correct. Then you establish what's called a buffer
- 4:23Speaker 2: with a standard initial value. You can think of it
- 4:25Speaker 2: as like the starting ingredients in a mixing bowl. Got it.
- 4:29Speaker 2: This buffer, along with the very first five to twelve
- 4:32Speaker 2: bit message block, gets fed into a processor function. This
- 4:36Speaker 2: function does all the heavy mathematical.
- 4:37Speaker 1: Scrambling, and the output of that first mix isn't the
- 4:40Speaker 1: final answer, right, No, not at all.
- 4:42Speaker 2: That output, that intermediate digest. It becomes the essential new input,
- 4:46Speaker 2: the new buffer for the next round of.
- 4:48Speaker 1: Processing, and the second input for that round is.
- 4:51Speaker 2: The second five hundred and twelve bit block of the
- 4:53Speaker 2: message ah okay.
- 4:54Speaker 1: So it's like a chain of digital dominoes. The result
- 4:57Speaker 1: from processing block one sets the startup point for processing
- 5:01Speaker 1: block too.
- 5:01Speaker 2: It's a cascading sequence. It just keeps going block after
- 5:05Speaker 2: block until you get to the very last one. The
- 5:07Speaker 2: final function takes the output from the second to last
- 5:10Speaker 2: step and mixes it with the very last five to
- 5:12Speaker 2: twelve bit message.
- 5:13Speaker 1: Block, and that final output from that entire chain is
- 5:16Speaker 1: the one hundred and sixty bit message digest.
- 5:19Speaker 2: That's it.
- 5:19Speaker 1: That makes so much sense from a security perspective, because
- 5:23Speaker 1: if I change just one tiny bit in the very
- 5:26Speaker 1: first block of the message. That tiny change just ripples
- 5:29Speaker 1: through every single step after it completely scrambling the final digest.
- 5:34Speaker 2: That's how it guarantees data integrity. So integrity, that's half
- 5:38Speaker 2: the battle. But it only tells us the message wasn't changed.
- 5:42Speaker 2: It doesn't tell us who sent it.
- 5:44Speaker 1: Right now, we have to deal with digital identity, and
- 5:47Speaker 1: this is where things can go wrong in a well,
- 5:50Speaker 1: in a pretty funny way if it weren't so serious.
- 5:52Speaker 2: This is where we need a trusted way to bind
- 5:55Speaker 2: a public key to an actual person. Without that, you
- 5:58Speaker 2: get chaos.
- 5:59Speaker 1: And to illustrate this, let's talk about what we're calling
- 6:01Speaker 1: the pizza prank.
- 6:02Speaker 2: Right, let's walk through this classic failure. So you have Eve.
- 6:06Speaker 2: Eve wants to impersonate Bob and order four pizzas to
- 6:08Speaker 2: be delivered to Bob's house.
- 6:09Speaker 1: Okay, a classic brank. How does she do it digitally?
- 6:12Speaker 2: She writes up the order in an email and then
- 6:14Speaker 2: she signed it using her own private key.
- 6:16Speaker 1: Right, a digital signature needs a private key.
- 6:19Speaker 2: She sends this signed order to the pizza place. But
- 6:22Speaker 2: here's the trick with the order. She includes her public key,
- 6:26Speaker 2: but she falsely labels it Bob's public key.
- 6:30Speaker 1: Ooh, I see where this is going. The pizza place
- 6:32Speaker 1: gets an order from what looks like Bob's email. They
- 6:35Speaker 1: see a signature, and they see a public key that
- 6:37Speaker 1: says it belongs to Bob.
- 6:38Speaker 2: So they do what they're supposed to do. They take
- 6:40Speaker 2: the public key that was provided and use it to
- 6:43Speaker 2: check the signature on the order.
- 6:44Speaker 1: And since Eve used her own matching private key to.
- 6:47Speaker 2: Sign it, the signature checks out perfectly. The math works,
- 6:50Speaker 2: The pizza store system says verification successful, the order is authentic.
- 6:55Speaker 1: And the result is four pizzas that Bob didn't order
- 6:58Speaker 1: showing up at his door. The cryptography itself didn't fail,
- 7:02Speaker 1: but the trust system did exactly.
- 7:03Speaker 2: The pizza store had no way to trust the binding
- 7:07Speaker 2: the connection between the identity they saw Bob and the
- 7:10Speaker 2: public key they were given by the sender, who was
- 7:12Speaker 2: actually Eve.
- 7:13Speaker 1: So this is the problem that needs solving. How do
- 7:16Speaker 1: we fix the pizza prank?
- 7:18Speaker 2: This is where the Certification Authority or CAA comes in
- 7:21Speaker 2: as the trusted solution. A CAA is basically a universally
- 7:26Speaker 2: trusted third party. Its one critical job is to verifiably
- 7:30Speaker 2: bind a specific public key to a specific verified person
- 7:34Speaker 2: or entity.
- 7:35Speaker 1: So the CAA is like a digital passport office. It
- 7:38Speaker 1: checks your ID before it gives you the credentials.
- 7:40Speaker 2: That's a great analogy. So if Bob wants a public
- 7:43Speaker 2: key that people can trust, his first step isn't cryptographic
- 7:46Speaker 2: at all. It's administrative. He has to prove his identity
- 7:49Speaker 2: to the CAA.
- 7:49Speaker 1: How does he do that?
- 7:50Speaker 2: It could involve submitting legal documents proving he owns a
- 7:54Speaker 2: certain domain name, you know, real identity checks.
- 7:56Speaker 1: Okay, So once the CAA is satisfied that this is
- 7:58Speaker 1: the real Bob, what happens next?
- 8:01Speaker 2: They assign a public key to Bob, and this crucial
- 8:04Speaker 2: piece of information that this public key belongs to this
- 8:06Speaker 2: person Bob is written into a document. That document is
- 8:11Speaker 2: called a certificate.
- 8:12Speaker 1: But wait, a digital document can be copied and changed.
- 8:15Speaker 1: How do we protect the certificate itself?
- 8:17Speaker 2: Great question. We use the same kind of technology, just
- 8:20Speaker 2: at a higher level of trust. The certification authority uses
- 8:24Speaker 2: its own highly protected private key to digitally sign the
- 8:28Speaker 2: entire certificate.
- 8:29Speaker 1: Ah. So, because everyone's computer and browser already trusts the.
- 8:33Speaker 2: CAA, right, everyone already has the CAA's public key built in,
- 8:37Speaker 2: So that signature from the CAA proves the certificate is
- 8:40Speaker 2: legitimate and that the information inside hasn't been tampered with.
- 8:44Speaker 1: That makes the chain of trust so much clearer. We
- 8:47Speaker 1: don't have to trust some random key send in an email.
- 8:49Speaker 1: We just have to trust the CAA's signature on the certificate.
- 8:53Speaker 1: So let's bring it all together. Let's say Alice gets
- 8:55Speaker 1: a message that claims to be from Bob. How does
- 8:58Speaker 1: she use this system to avoid the pizza prank fate?
- 9:01Speaker 2: Okay, so Alice's goal is to get Bob's correct, verified
- 9:05Speaker 2: public key, not a key some impostor might have sent her.
- 9:08Speaker 2: She needs the one the ca certified and.
- 9:10Speaker 1: She gets that from his certificate.
- 9:12Speaker 2: Yep, Bob might have sent the certificate with his message,
- 9:15Speaker 2: or she could go get it from a public directory
- 9:17Speaker 2: of the CAA. Runs. Once Alice has that certificate document,
- 9:21Speaker 2: the critical verification step begins.
- 9:23Speaker 1: And let's be super clear on this sequence. What does
- 9:26Speaker 1: she do first?
- 9:27Speaker 2: First, she has to verify the certificate itself. She uses
- 9:31Speaker 2: the CAA's public key, the one built into her browser
- 9:33Speaker 2: or OS, to check the signature on the certificate document. Okay,
- 9:38Speaker 2: If the CA's public key successfully decrypts that signature. Alice
- 9:42Speaker 2: now knows two things for sure. One the CAA really
- 9:46Speaker 2: did issue the certificate, and two the contents, including that
- 9:50Speaker 2: all important binding of Bob's name to his public key,
- 9:53Speaker 2: have not been altered.
- 9:55Speaker 1: So she uses the CAA's key to unlock the certificate,
- 9:58Speaker 1: and that success is the guarantee that the key inside
- 10:00Speaker 1: that certificate is the real deal. It really belongs to Bob, that's.
- 10:04Speaker 2: Right, and that validated key from inside the certificate is
- 10:07Speaker 2: the one she can now confidently use to verify this
- 10:09Speaker 2: signature on the actual message she received from Bob.
- 10:12Speaker 1: So the whole system works together. The HASH proves the
- 10:15Speaker 1: message wasn't changed, and the CAA verified key proves it
- 10:18Speaker 1: really came from Bob.
- 10:19Speaker 2: Integrity the data and integrity of the identity. There are
- 10:22Speaker 2: two indispensable layers that have to work together.
- 10:24Speaker 1: That was an incredible deep dive into the absolute roots
- 10:28Speaker 1: of how we trust anything online. So to sum it
- 10:31Speaker 1: up really quickly, hashing like MD five or SAHA one
- 10:35Speaker 1: proves the data is untouched, but the certification authority proves
- 10:38Speaker 1: the sender is who they claim to be.
- 10:40Speaker 2: They ensure the interaction is both true and from the
- 10:43Speaker 2: correct source.
- 10:44Speaker 1: Absolutely fascinating. Okay, before we wrap, let's leave you with
- 10:47Speaker 1: a final thought to chew on. We talked about MD
- 10:49Speaker 1: five at one hundred and twenty eight bits and SAHA
- 10:52Speaker 1: one at one hundred and sixty bits. Now, thinking about
- 10:54Speaker 1: what we discussed, why is that longer one hundred and
- 10:57Speaker 1: sixty bit digestive SAHA one fundamental not only more robust
- 11:01Speaker 1: than the shorter one twenty eight bit one.
- 11:02Speaker 2: And to add to that, how does that cascading process
- 11:05Speaker 2: and processing the message in that chain of five hundred
- 11:07Speaker 2: and twelve bit blocks, How does that contribute to making
- 11:10Speaker 2: it exponentially harder to find one of those malicious collisions?
- 11:12Speaker 1: Think about the massive, almost unimaginable scale of possibilities that
- 11:16Speaker 1: just those thirty two extra bits represent, and how that
- 11:18Speaker 1: chain reaction magnifies every tiny detail. Something to think about
- 11:22Speaker 1: this week. Until next time, keep diving deep