In the last post, we have learned what an elliptic curve is, how it is used in cryptography and we saw an example of how Alice can encrypt her message to Bob using Bob’s public key and her own private key. We also saw how Bob is able to decrypt this message by multiplying Alice’s public key with his private key and subtracting the result from the encrypted message to get the clear text message.
An eavesdropper, by the name of Eve, has seen the exchanges between Alice and Bob and she wants to be able to decrypt the message of Alice. However, she only sees the public keys of Alice and Bob, the encrypted message, the elliptic curve equation used and the modulus. How can she decrypt the message?
Discrete Logarithm Problem
Eve knows both the public key of Alice and Bob. If she can somehow compute the private key, she will be able to decrypt the message. The public key of Alice is
Alice Public Key=Pa=eaBWhere ea is the private key of Alice and B is the base point of the elliptic curve agreed before hand by Alice and Bob. Using a group theoretic notation, we can also write this as
Pa=Beawhere the group “multiplication” operation is defined at the addition of points defined in the last blog post, that is,
Bn=B+B+B⏟n timesand B0=O, the identity element (point at infinity).
If Pa=Bea, then
ea=logBPaSolving for ea is called the discrete logarithm problem.
Quantum Algorithm
If Eve has access to a quantum computer, she can use Shor’s Algorithm to find the value of ea. The trick to using Shor’s algorithm is to create a periodic function f such that the period of f is ea. To do this, define
f(a,b)=Ba−eabIf (a1,b1) and (a2,b2), notice that f(a2,b2)=f(a1,b1) if (a2,b2)=(a1,b1)+k(ea,1). To see this,
f(a2,b2)=Ba2−eab2=B(a1+kea)−ea(b1+k)=Ba1+kea−eab1−kea=Ba1−eab1=f(a1,b1)Eve will prepare 2 input registers and prepare the quantum state to be a superposition of all values of the basis vectors |a⟩|b⟩
1pp−1∑a=0p−1∑b=0|a⟩|b⟩⊗|0⟩She will then apply an operator Uf defined as
Uf|a⟩|b⟩|0⟩=|a⟩|b⟩|f(a,b)⟩to get
1pp−1∑a=0p−1∑b=0|a⟩|b⟩|f(a,b)⟩where f is the periodic function defined as above.
A measurement of the output register system will then yield a specific value f, which corresponds to m values of a and b because of the periodic nature of the function:
1√mm−1∑k=0|a0+kea⟩|b0+k⟩To solve for ea, we apply the Quantum Fourier Transform as defined here:
UFT⊗UFT1√mm−1∑k=0|a0+kea⟩|b0+k⟩=1√mm−1∑k=0UFT|a0+kea⟩⊗UFT|b0+k⟩=1(p−1)√mm−1∑k=0p−2∑x=0p−2∑y=0e2πi(a0+kea)x/(p−1)e2πi(b0+k)y/(p−1)|x⟩|y⟩=1(p−1)√mm−1∑k=0p−2∑x=0p−2∑y=0e2πi/(p−1)[(a0x+b0y)+k(eax+y)]|x⟩|y⟩=1(p−1)√mp−2∑x=0p−2∑y=0e2πi(a0x+b0y)/(p−1)m−1∑k=0e2πik(eax+y)/(p−1)|x⟩|y⟩The probability of getting a specify x and y is given by the square of the amplitudes:
1(p−1)2m|m−1∑k=0e2πik(eax+y)/(p−1)|⏟If we let
f=eax+yp−1we can write the quantity in underbrace as
sin2(πfm)sin2(πf)which is maximum when f is an integer, that is,
e_ax + y = 0 \mod p-1After a measurement of the input registers, we get a specific value of x and y. We can then compute the private key using:
e_a = -y x^{-1} \mod p-1where x^{-1} is the inverse of x \mod p-1.
Example
Suppose after we measure the input registers, we get the values x=51, y=44. We can compute for the private key as follows:
\begin{array}{rl} e_a &= -y x^{-1} \mod p-1\\ &= -44(51)^{-1} \mod 70\\ &= -44(11) \mod 70\\ &= 6 \end{array}Decrypting the Message
Suppose we are given the following parameters: The elliptic curve equation is y^2 = x^3 - 3x +3 \mod 71 , the base point is (0,28), Alice’s public key is (61,58), Bob’s public key is (30,2) and the encrypted message is (23,12).
Eve uses the Quantum Computer to compute Alice private key to get e_a = 6. She can then multiply Bob’s public key with Alice’s private key to get 6\times (30,2) = (10,60). Subtracting this from the encrypted text, we get (23,12) + (10,-60) = (17,54), which is the decrypted message.
Image Credit: “Print Gallery solved (2003) - H.W. Lenstra (1949)” by pedrosimoes7 is marked with CC BY 2.0. To view the terms, visit https://creativecommons.org/licenses/by/2.0/?ref=openverse