An Encryption Short Story
In this short story, we are going to explore how two
people can exchange confidential information.
We are going to use the names Alice, Martha, and
Bob for our three characters.
Alice and Bob want to exchange confidential
information, but Martha is a hacker and is always
trying to steal their information.
We will start with a few definitions
Hashing Algorithms
Encryption Algorithms
2
Hashing algorithms are used to help determine data integrity.
Hashing algorithms are always “one way” which means that you cannot
get the original document back from its hash.
The result of applying a hashing algorithm to a file is a fixed sized result,
called a message digest or a hash or a hash code.
Hash code sizes are typically 128, 160, 192, 256, or even 512 bits.
If you accidentally change a document, the hash of the changed
document will be different from the original hash.
To verify data integrity using a hash
Compute the original document hash and send the document and the
hash to the receiver. The receiver gets the original document and your
hash, and then computes the hash of the received document.
If the sent hash equals the receiver’s computed hash, the
document is considered unchanged.
3
• Encryption algorithms are used to help ensure
data confidentiality. There are two main types of
encryption algorithms
• Symmetric – same key that encrypts the
information must be used to decrypt the information
• Asymmetric – there are two keys, a public key and
a private key. These were developed to make sharing
and distributing keys easier.
• Unlike hashes, encrypted data can be
decrypted.
4
Data Confidentiality Between Alice and Bob
Martha is a hacker who likes to eavesdrop on people’s e-mail
transmissions and download files from Web and FTP sites
Alice has a file of confidential data she wants to send to Bob, and be
certain that only Bob can read the contents
Alice could e-mail the data to Bob or put it on a Web or FTP site. She is
aware of Martha and decides to be proactive about her message to Bob.
Alice decides to encrypt the file before sending it to Bob, using the fast,
secure, and efficient AES 128 bit symmetric algorithm
Alice
Hey Bob,
I have a secret,
128 bit AES
The AES
cipher text
Dfgh1H23jkdbyRgt5YH
sfsgT%^dgcdnmjdh%%
Bob
128 bit AES
can you keep it? ...
Alice’s plaintext
Hey Bob,
I have a secret,
can you keep it? ...
Secret key
Encryption
Secret key
Decryption
Bob’s plaintext
5
Symmetric Key Confidentiality
Alice chose AES, a symmetric algorithm, so Bob needs a copy of the secret key
that Alice used to encrypt the file so that he can decrypt the file
Alice
Could email or ftp the key to Bob, or put it on a web site for Bob to get
Remembers that Martha is always looking for such information
Could phone Bob, but may never have met him or have his number
Alice decides to encrypt the AES key with RSA before sending it to Bob
Alice needs a copy of Bob’s Public RSA key
Because Bob is the only one who has the matching Private key, only Bob could
decrypt the encrypted AES key
To encrypt the secret key to Bob, Alice needs a copy of Bob’s public key
Only Bob can decrypt the secret key, because he has the corresponding private key
6
Data and Symmetric Key Confidentiality
Alice
Bob
The AES key is not sent
over the network, but
the cipher text is.
plaintext
plaintext
Hey Bob,
I have a secret,
AES
Dfgh1H23jkdbyRgt5YH
sfsgT%^dgcdnmjdh%%
Hey Bob,
AES
can you keep it? ...
I have a secret,
can you keep it? ...
Cipher text
Secret key
RSA
Bob’s Public
key
encrypted Secret key
16798645fr32
Secret key
RSA
Bob’s Private key
7
How Can Alice Get & Trust Bob’s Public Key
Bob obtains a public key certificate from George as follows:
First, Bob creates a public / private key pair. He will keep his private key to himself,
but he wants to distribute his public key to anyone.
George checks to make sure that the public key belongs to Bob
George builds Bob’s public key certificate, which contains a number of items,
including Bob’s name and public key, and validity dates.
George calculates the hash of all the fields in the certificate and then encrypts the
hash with his own private key to produce the digital signature for Bob’s certificate.
Alice obtains her public key certificate in a similar manner.
Alice and Bob trust George and have his public key in a credential file
Alice can get a copy of Bob’s public key certificate from George or Bob
Similarly, Bob can get a copy of Alice’s public key certificate
8
Alice and Bob Both Trust George, a CA
Alice’s public key certificate
contains Alice’s name and her
public key and is digitally signed
by George.
George’s digital signature is a
hash of the contents of her
certificate, encrypted with
George’s PRIVATE key.
George
George’s
public key
certificate
George’s
signature
X.509
Alice
Similarly Bob’s
public key
certificate
contains his
name and
public key and
is signed by
George.
Certification
Authority
Or CA
George formats his
Public key
certificates into a
standardized form,
known as X.509.
X.509
Trusted
Third
Party
Alice’s
public key
certificate
George’s
signature
Third-party trust
X.509
X.509
George’s
public key
certificate
George’s
signature
Bob
Bob’s
public key
certificate
George’s
signature
9
Verifying Bob’s Certificate
George
Alice
X.509
Bob’s
public key
certificate
Step 1
h1
X.509
George’s
public key
certificate
George’s
public key
George’s
signature
Step 1
Decrypt
George is a Trusted
Third Party or TTP
{George’s
Private key}
Step 2:
Get hash of fields in
Bob’s certificate to
produce h2
Bob
Bob’s Public
key
To Verify Bob’s public key certificate and extract his public key,
1. Alice uses George’s public key in her credentials file to decrypt George’s
digital signature on Bob’s certificate. This produces a hash, h1.
2. Then Alice uses the same hashing algorithm that George used to generate
a hash of the contents of Bob’s certificate, h2.
3. Alice compares h1 and h2. If they are equal, since Bob’s public key is in
his certificate, she now has a good copy of it. Since Bob’s name is also in the
certificate, she has authenticated Bob as well.
10
What about Martha?
Using public key certificates,
Alice can send confidential data to Bob as shown on slide 7
Bob can send confidential data to Alice as shown on slide 7
What can Martha Do if Alice Just used Message digests?
If Alice just used message digests, Martha could intercept a message, add or
delete data, rehash it, add the new message digest to it, and send it to Bob.
Bob would verify the message by calculating a message digest of the received
data, and then comparing it to what “Alice” sent.
Martha would have won in that case!!
What can Martha Do if Alice uses Digital Signatures?
As before, Martha could intercept the message, and add data, but she could
not sign it as Alice!
Why Not? Because she does not have Alice’s private key!!!
Moral
Alice and Bob need to keep a close watch on their PRIVATE KEYS!!
11
© Copyright 2026 Paperzz