



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




University of Illinois, Urbana Champaign CS/ECE 498AC3/4 Applied Cryptography
Instructor: Dakshita Khurana Scribe: Eric Cao, Brikhoff Cheng Date: September 22, 2020
Public Key Encryption 1
In previous lectures we discussed symmetric key encryption, which requires a secret key to be transferred through a covert channel. Since we cannot share the key covertly in symmetric key encryption, we must bootstrap the process. The method for setting up this shared secret is public key encryption. Unlike symmetric key encryption, each party in public key encryption has two keys (a public and private key). In this setup, Alice can encrypt a message with Bob’s public key and Bob can decrypt the ciphertext with his secret key. From an adversarial perspective, all information here is either public or encrypted, which makes this a secure mechanism to distribute the shared secret key for symmetric key encryption. In this lecture, we look at key exchange and the mathematical fundamentals that make public key encryption possible. Public key encryption is based on the assumption of fun- damentally hard problems called one-way trapdoor functions. These are an extension on the one-way functions talked about previously when discussing hash functions. Just like one-way functions, these functions are easy to compute, but hard to invert. However, these functions have a trapdoor, which is a secret that allows us to efficiently invert the func- tion. This trapdoor is what allows for decryption of the message to be efficient for Alice and Bob, while any adversaries without access to the secret key have a negligible probability of uncovering the plaintext. One such hard problem is the discrete log problem, which we explore in detail since the Diffie-Hellman problem is based on it.
As the discrete logarithm problem that underpins the Diffie-Hellman Key Exchange has its roots in number theory, we will begin by covering constructs in number theory and notation. We will be using ZN to represent the set of equivalence classes modulo N and (ZN )∗^ will be the set of invertible elements in ZN. In group theory, there is a concept called a cyclic group. A cyclic group is a group that is generated by an element g such that every element in the cyclic group can be obtained by applying a single operation. We use multiplication modulo p for this.
Definition 9.1. (Zp)∗^ is a cyclic group. This means there exists a generator g such that { 1 , g, g^2 , ..., gp−^2 } = (Zp)∗.
Example 9.2. For p = 7. 3 is a generator. { 1 , 3 , 32 , 33 , 34 , 35 } = { 1 , 3 , 2 , 6 , 4 , 5 }. Despite 2 being in the generated set it is not a generator since { 1 , 2 , 22 , 23 , 24 , 25 } = { 1 , 2 , 4 }
As shown in the example, though every element e appears in the cyclic group (Zp)∗, not every element in (Zp)∗^ is a generator for (Zp)∗. So the natural question is how do we find generators for the group (Zp)∗? To do this, we must first define the order of a group. In (Zp)∗, the set { 1 , g, g^2 , ...} =< g > is the group generated by g. This means g is a generator if and only if < g >= (Zp)∗. We call the size of this group its order.
Definition 9.3. The order of g ∈ (Zp)∗^ is the size of < g >
ordp(g) =|< g >|= smallest a s.t. ga^ = 1
So, how does the order relate to the generator? Well Lagrange’s theorem allows us to identify potential primes whose generators are easy to find.
Theorem 9.4. Lagrange’s theorem. For all g ∈ (Zp)∗^ the ordp(g) divides p − 1
So, we can see that as long as pick p such that p − 1 has very few factors. For example if (p − 1) = a 1 a 2 where a 1 , a 2 are primes, then there are only 4 possibilities for the order 1 , a 1 , a 2 , a 1 a 2. So, we can pick a random element and compute the order. We know that one of g^1 = 1, ga^1 = 1, ga^2 = 1, ga^1 a^2 = 1, so we continue until we find a generator such that ga^1 a^2 = 1. By doing this, we can make guess and check an efficient algorithm to find generators. A lot of public key cryptography is based on the notion of picking a group, finding its generators, and relying on hard problems for the one-way function. For example, RSA is based on Euler generalization of Fermat’s little theorem. Recall that Fermat’s little theorem states that for any number x and prime p that is relatively prime, then xp−^1 is also relatively prime with p.
Theorem 9.5. Fermat’s little theorem. Formally, let p be an arbitrary prime number. Then, ∀x ∈ (Zp)∗^ xp−^1 ≡p 1.
Fermat’s theorem has a few applications, which include a way to compute inverses as x ∗ xp−^2 ≡p 1 =⇒ x−^1 ≡p xp−^2 and as a primality test. You can draw a random number p and test if 2p−^1 ≡p 1 efficiently. Note that this test is not perfect as 2^341 −^1 ≡ 341 1. Since 341 = 11 × 13, the test incorrectly identified 341 as a prime. Euler later generalized Fermat’s little theorem to non-prime values. To do this, he defined a totient function ϕ to be the number of invertible elements in ZN for any integer N. Notably, for n = pq, ϕ(N ) = (p − 1)(q − 1).
Definition 9.6. Euler’s totient function. For integer N, ϕ(N ) = |(ZN )∗|.
Theorem 9.7. ∀x ∈ (ZN )∗, xϕ(N^ )^ = 1 in ZN.
So, know both Alice and Bob know the value gab. As long as we assume that given ga, gb, and g it should be hard to find gab, they have successfully shared a secret key that the adversary cannot figure out. This problem is called the Computational Diffie-Hellman Problem. This problem is hard only if discrete log problem is hard. This is fairly trivial since if discrete log is easy, we can find a and b by computing the discrete log and then compute gab. However, this is a stronger assumption than what discrete log uses so it is possible for the Computational Diffie-Hellman problem to be easy while the discrete log problem is hard.
Open Problem 9.10. Can we use the discrete log problem or some one-way function by itself to establish shared secrets? Do we need to rely on another assumption like the com- putational discrete log problem?
There are a lot of impossibilities that make key exchange hard only using discrete log. In practice, we know that one-way functions are easier to implement than mechanisms to share secret keys. Now let’s see that if we have a pre-shared key, can we use a private encryption scheme with rerandomization to do public key encryption. This is called re-randomizable encryption. We propose two methods for implementing re-randomizable encryption. We can use the three-pass protocol in order to do this. The intuition for this is pretty simple. Imagine the key is a treasure chest, Alice locks the chest with her key before passing the chest to Bob to prevent anyone from opening the chest. Bob will then add his key before passing it back to Alice. Alice removes her key and passes it back to Bob. Bob removes his key and has the unlocked chest. Since any adversary monitoring the communication never sees an unlocked chest, they can never open it. To make this more formal, we rely on the assumption that for our encryption algorithm D(d, E(k, E(e, m))) = E(k, m) for any arbitrary key k. This is possible with a commutative encryption scheme. We declare keys e, d to be Alice’s encryption and decryption keys and k, l to be Bob’s decryption keys.
Alternatively, you can use re-randomization. Alice publishes c 0 = E(kA, 0), c 1 = E(kA, 1). If Bob can inject randomness by picking cb and rerandomizes to get c˜b. Send c˜b back to Alice. We want c˜b to map to the same bit that was originally chosen by Bob and for it to
be computationally hard for an attacker to tell from c˜b if 0 was rerandomized or if 1 was rerandomized. This property is satisfied by homomorphic encryption. Note that the three pass protocol from before is not secure with xor encryption since we reuse Bob’s key twice as an encryption for the plaintext and as a reencrpytion of Alice’s ciphertext
m 1 = kA ⊕ m. m 2 = kA ⊕ m ⊕ kB. m 3 = kB ⊕ m. So, the attacker can compute
m 1 ⊕ m 2 ⊕ m3 = m. So, we have create a way to distribute the keys using public key cryptography. Is this mechanism secure? It is not. If we have a man in the middle, the man in the middle can pretend to be Bob to Alice and pretend to be Alice to Bob.
Definition 9.11. Public key encryption system E = (G, E, D)
G(): randomly generates a key pair (sk, pk) E(pk, m): randomized algorithm that encrypts message m and outputs ciphertext c. D(sk, c): deterministic algorithm that decrypts ciphertext c and outputs message m. such that ∀(pk, sk), ∀m ∈ M, D(sk, E(pk, m)) = m
Definition 9.12. Semantic Security of Public Key Encryption System
We say a cipher E is sematically secure if ∀A,
AdvSS [A, E] = | Pr[EXP (0) = 1] − Pr[EXP (1) = 1]| < δ
where δ is negligible.
With a semantically secure public key encryption system, we can easily construct a key exchange protocol, where Alice publishes her public key pk, Bob sends a secret key x encrypted with that public key, and Alice decrypts that message to get the secret key x.