7CCSMCIS Cryptography and Information Security
What is a one-way function and what are its properties?
A function
What is a trapdoor one-way function? Give one example.
A trapdoor one-way function
e.g. modular cube roots when we know
Use both Euclid’s algorithm and Extended Euclid’s algorithm to compute
, showing all steps of the computations.
Euclid(a, b):
if b == 0:
return a
else
return Euclid(b, a % b)
Extended Euclid’s (Unravelling):
Remember:
Consider the primes
and .
Calculateand
For this we should know:
Explain which of the values
or is usable as a public key for this given .
We have to choose an
Let’s try
As we can see,
As we can see,
Use the Extended Euclid’s algorithm to calculate
with the you have chosen.
We find our
We get
Encrypt
and then decrypt the resulting ciphertext.
We use
Decryption:
Using
Consider the RSA algorithm with
and .
- Encipher the plaintext
.
Use
- Break the cipher by finding
, and .
We know:
,
We can guess
To find
We have
Perform encryption and decryption using the RSA algorithm for the following:
, , ,
- Select
such that and . - Use Extended-Euclid’s algorithm to find
.
Let’s try
Encryption:
We know
Decryption:
We know
, , ,
- Select
such that and . - Use Extended-Euclid’s algorithm to find
.
Encryption:
We know:
Decryption:
We know:
Consider the RSA algorithm with
, and .
Encipher the plaintext
.
We know:
Decipher the resulting ciphertext
to obtain again .
We know:
Decryption:
Why are these
, and not really a good choice for RSA?
They are very small numbers which can be brute-forced quite quickly. Normally RSA will use numbers represented by 1024+ bits.
Consider a Diffie-Hellman key exchange with
, , , . Compute and , and the secret key .
We know:
Therefore
Consider a Diffie-Hellman scheme with
, , , . Compute and , and the secret key .
We know:
Describe the man-in-the-middle attack to the Diffie-Hellman key exchange and how it could be prevented.
As Diffie-Hellman doesn’t provide authentication, any attacker, Charlie, could place themselves inbetween unsuspected agents, Alice and Bob. Charlie can complete the DH protocol with both Alice and Bob by intercepting their messages and establish a shared key for Alice and a separate shared key for Bob.
This attack can prevented by the use of digital signature schemes.
Describe the Diffie-Hellman key exchange protocol for three honest principals Alice, Bob and Carol. What would be the secret key for
principals ?
- Alice, Bob and Carol all generate their random large private integer
, , respectively and calculate their public integer . - Each agent sends another agent’s public integer raised with their private key to another agent (in a circular chain).
- Alice sends Carol’s public integer raised with her private integer (
) to Bob. - Bob sends Alice’s public integer raised with his private integer (
) to Carol. - Carol sends Bob’s public integer raised with her private integer (
) to Alice.
- Each agent calculates the shared key by raising what they receivied with their private integer.
- Alice calculates
. - Bob calculates
. - Carol calculates
.
Describe the El Gamal algorithm
El Gamal is a sped up version of DH where agent
. calculates and sends it to $$B$. . calculates AND computes the shared key and uses it to encrypt a message . calculates to get the shared key .
Consider the El Gamal algorithm with
, , , .
Consider the plaintext
and let symmetric encryption be just the multiplication of the plaintext and the key (not a good encryption, of course, but that is not the point here).
Carry out the algorithm (for encryption).
Why are these
, , , not adequate for El Gamal? Where is the problem? Would or be better?
They result in all of the keys being
Explain in detail the main characteristics of cryptographic hash functions and give an example of an application.
The motivation behind hash functions is to create a fingerprint. A hash function,
- Compression:
maps an input of arbitrary bit length to an output of fixed bit length . - Polynomial time computable.
A cryptographic hash function is additionally:
- One-way (where given
, it is hard to compute an where ). - And either:
- 2nd-preimage resistant: it is computationally infeasile to find a second input that has the same output as any specified input.
- Collision resistant: it is difficult to find two distinct inputs
, where .
Explain in detail how Message Authentication Codes (MAC) work.
Bob and Alice both share a secret key
Explain in detail the main characteristics of a digital signature scheme. How can RSA be used for digital signatures?
Digital signatures take advantage of reversible public-key cryptosystems. A message can be encrypted with Alice’s private key; thus anyone with Alice’s public key (everyone) can decrypt the message, proving it was sent by Alice.