Skip to content
ImagineWorld

Elliptic Curves

node_idnode-book_cryptography-algorithms_chapter-07-elliptic-curves
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num7
chapter_titleElliptic Curves
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Elliptic curves are the new frontier for decentralized finance. Satoshi Nakamoto adopted a particular kind of elliptic curve to implement the transmission of digital currency, called secp256k1. Elliptic Curve Cryptography (ECC) is highly used in embedded devices because of its smaller keys and reduced power consumption for private key operations. Let’s see how it works and what the main characteristics are of this very robust encryption.

In this chapter, we will learn the mathematical basics of ECC. I will explain what we are doing, but it’s worth understanding from the beginning that elliptic curve cryptography is a complex topic, involving geometry, modular mathematics, digital signatures, and logic.

To help demonstrate the mathematics, I will present how secp256k1 is implemented for the digital signature of Bitcoin.

Finally, we will discuss the possibility of an attack on elliptic curves.

In this chapter, we will cover the following topics:

  • The genesis of cryptography on elliptic curves
  • The mathematical and logical basics of elliptic curves
  • The Diffie–Hellman key exchange based on elliptic curves
  • An explanation of ECDSA on secp256k1: the digital signature of Bitcoin
  • Possible attacks on elliptic curves

Let’s dive deep into this intriguing topic, based on geometry and applied in cryptography.

Around 1985, Victor Miller and Neal Koblitz pioneered elliptic curves for cryptographic uses. Later on, Hendrik Lenstra showed us how to use them to factorize an integer number.

Elliptic curves are essentially a geometrical representation of particular mathematical equations on the Cartesian plane. We will start to analyze their geometrical models in the 2D plane, conscious that their extended and deeper representation is in 3D or 4D, involving irrational and imaginary numbers. Don’t worry about these issues for now; they will become clearer later on in this chapter.

ECC is used as a valid alternative to some of the asymmetric algorithms we have seen in previous chapters, such as RSA and ElGamal. We will also see that is possible to implement Diffie–Hellman on a particular ECC algorithm.

Moreover, after the advent of the revolution in digital currency, a particular type of elliptic curve called secp256k1 and a digital signature algorithm called Elliptic Curve Digital Signature Algorithm (ECDSA) have been used to apply digital signatures to Bitcoin, ensuring that transactions are executed successfully.

This chapter intends to take you step by step through discovering the logic behind elliptic curves and transposing it to digital world applications.

It has been estimated that using 313-bit encryption on elliptic curves provides a similar level of security as 4,096-bit encryption in a traditional asymmetric system (see www.keylength.com). Such low numbers of bits can be convenient in many implementations that require high performance in timing and bandwidth, such as mobile applications.

So, let’s start to explore the basis of elliptic curves, which involve geometry, mathematics, and many logical properties that we have seen in earlier chapters of this book.

The first observation is that an elliptic curve is not an ellipse. The general mathematical form of an elliptic curve is as follows:

Important Note

E: represents the form of the elliptic curve, and the parameters (a, b, and c) are coefficients of the curve.

Just to give evidence of what we are discussing, we’ll try to plot the following curve:

As we can see in the following figure, I have plotted this elliptic curve with WolframAlpha represented in its geometric form:

Figure 7.1 – Elliptic curve: E: y^2 = x^3 + 73

Figure 7.1: Elliptic curve, E: y2 = x3 + 73

We can start to analyze geometrically and algebraically how these curves work and their prerogatives. Since they are not linear, they are easy to implement for cryptographic scopes, making them adaptable.

For example, let’s take the curve plotted previously:

When (y = 0), we can see that, geometrically, the curve intersects the x axis at the point corresponding to (x = -4.1793…); this is mathematically given if we substitute y = 0 into the equation:

As a result, one of the three roots of the curve will be the cubic root of -73.

When (x = 0), the curve intersects the y axis at two points: (y = +/-8.544003…). Mathematically, we substitute (x = 0) into the equation:

This obtains the intersection between the curve and the axis of y, as you can see in Figure 7.1.

Another curious thing about elliptic curves in general is that they have a point that goes to infinity if we intersect two points in the curve symmetrically with respect to the y axis. You can imagine the third point as an infinite point lying at the infinite end of the y axis. We represent it with O (at the infinity point). We will see this better later when we discuss adding points to the curve.

One of the most interesting properties of elliptic curves is the SUM value of two points of the curve. Here, we define addition on the curve itself.

As you can see in the following figure, if we have two points, P and Q, and we want to add P to Q, it turns out that if we draw a line between P and Q, a third point, -R, is given by the intersection between this line and the curve. Then, if you take a reflex of point -R with respect to the x -axis line, you find R; this is the sum of P and Q.

It’s easier to take a look at the following diagram to understand this geometrical representation of the SUM value:

Figure 7.2 – Adding and doubling points on the elliptic curve

Figure 7.2: Adding and doubling points on the elliptic curve

Now, let’s look at how the addition point will be represented algebraically.

First, we take the coordinates of P and Q, and then calculate (s), as follows:

To compute xR, the x coordinate of point R, we have to perform this operation:

To compute yR, the y coordinate of point R, we have to perform this operation:

What about computing P + P = R = 2P, the so-called point double?

If we want to represent a P point added to itself so that it becomes 2P, the geometrical representation is given by the tangent passing through the P point and intersecting the curve at the R point, again finding the reflexed point of the sum, which is the symmetric point R, as shown here:

Figure 7.3 – 2P point double

Figure 7.3: 2P point double

Geographically, it is very similar to computing the sum of the point, as we saw in the preceding example.

We have to draw the tangent line in the P point, and we find the point of intersection between the line and the curve in the R’=(-2P) point; finally, the reflexed x -axis point on the curve will give the P double point, that is, R(2P).

What about computing P+P algebraically? In this case, (t) will be the following:

Remember that (a) is a parameter of the curve.

So to find the x coordinate of R, we have the following:

The equation for the y coordinate of R is as follows:

There is one more scenario we need to address when we operate with elliptic curves: how to add vertical points.

Here, O is represented by the point of infinity, given by the SUM value between P and Q if xP = xQ. The straight line obtained by the conjunction of P and Q is parallel to the Y axis, as you can see in the figure below:

Figure 7.4 – Adding vertical points

Figure 7.4: Adding vertical points

Algebraically, the point at infinity is given as follows:

Alternatively, it can be given like this:

As an example, let’s assume that we are adding two points, A and B. They can be defined in the following way:

With this in mind, we can understand how to add these points using the following equations:

If, instead of adding A and B, we are interested in doubling them*, 2*A = A+A* is obtained like this:

Now that we have seen how to add and double points, let’s see how to perform scalar multiplication, another important operation for cryptography on elliptic curves.

At this point, we have to get familiar with another typical operation of elliptic curves, scalar multiplication. This process mathematically represents the sum between P and Q and makes it possible to calculate 2P, 3P, …, nP on elliptic curves.

The logic behind scalar multiplication is not difficult, but it needs practice to become familiar with it.

Practically, let’s solve a multiplication on the elliptic curve of the following form:

This is called repeated addition, and it can be represented as follows:

As we have to add the coordinates of a point to itself, we can figure out the scalar multiplication as the sum of a point with itself n times, so we have, for example, the following:

This, as we have seen, is the formula of the double point (geometrically represented in Figure 7.3) transposed to an algebraic representation of SUM.

Always remember that we are dealing with a curve, so the coordinates of the new intersection point are as follows:

For the same logic, we can go on with 3P, 4P, … 7P:

Then, we follow with 4P:

Then, we follow with 5P:

Then, we follow with 6P:

Alternatively, it can be given like this:

Finally, we have the following:

Alternatively, it can be given like this:

This is called multiplication, but in reality, scalar multiplication is more of a breakdown of the R number in a scalar mode because, as you can see, step by step, it will be reduced to the minimal entity of P: so, for instance, 7P becomes a product of P and 2P.

Following this logic, if we have to multiply a K number with P, we have to break it down to obtain a sum of minimal elements (P+P) or a 2P double point that will compose the multiplication required. Because of the formulas, we rely on addition and multiplication, as we saw in Figure 7.4.

If we have 9P, for example, we will have the following:

Now that we have understood this operation’s logic, let’s discover why these operations are so important to generate a cryptographic system on elliptic curves.

As we saw in the previous chapters (for example, D–H in Chapter 3, Asymmetric Encryption Algorithms), in cryptography, we are looking for one-way functions. These particular functions make it easy to compute in one direction, but they are very difficult to perform in the opposite sense. In other words, it isn’t easy to reverse-engineer the result.

Similarly, in elliptic curves, we have to find a function such as a discrete logarithm that allows us to perform a one-way function. To this end, scalar multiplication is considered to be a one-way function. So, we’ll now define the discrete logarithm problem transposed on an elliptic curve.

Let’s start with an elliptic curve, E. There are some parameters that we can treat as known, namely, P; Q is a multiple of P. The task is to find k**,** such that Q = k * P. This is a hard problem to solve.

This is called a discrete logarithm problem of Q to the P base, and it is considered hard to solve because finding k means calculating very complex operations. I will proceed with an example to better understand what we are dealing with.

Example

In the elliptic curve group defined by the following, what is the discrete logarithm k of Q = (4,5) to the P = (16,5) base?

One (naïve) way to find k is to compute multiples of P until Q. The first few multiples of P are as follows:

Since 9P = (4,5) = Q, the discrete logarithm of Q to the P base is k = 9.

In a real application, k would be large enough that it would be infeasible to determine k in this manner.

This is the fundamental principle behind the D-H algorithm implemented on elliptic curves, which we will discover next.

Implementing the D-H algorithm on elliptic curves

Section titled “Implementing the D-H algorithm on elliptic curves”

In this section, we will implement the D–H algorithm on elliptic curves. We saw the D–H algorithm in Chapter 3, Asymmetric Encryption Algorithms. You should remember that the problem underlying the D–H key exchange is the discrete logarithm. Here, we will demonstrate that the discrete logarithm problem could be transposed to elliptic curves too.

First of all, we will deal with an elliptic curve (mod p). The base point or generator point is the first element in the D–H original algorithm represented by (g), and here, we denote it by (G). Let’s look at some elements to take into consideration:

  • G: This is a point on the curve that generates a cyclic group.

A cyclic group means that each point on the curve is generated by a repeated addition (we have seen point addition in the previous section). Remember that we have seen cyclic groups before, when we first learned about D-H in Chapter 3, Asymmetric Encryption Algorithms.

  • Another concept is the order of G, denoted by (n):

The order of (G) = (n) is the size of the group.

The order (n) is also the smallest positive integer, [k], giving us the following:

  • The next element to take into consideration is the h cofactor:

In other words, (h) can be defined as the number of points on E (mod p) divided by the order of the curve (n).

A value of h = 1 is optimal, whereas if h > 4, the curve is more vulnerable to attacks (check out the following source to learn more about weak keys: https://eprint.iacr.org/2005/030.pdf).

Let’s now analyze step by step how D–H transposed on E works.

Step 1: Parameter initialization

Now, let’s look at the public shared parameters to initialize the D–H model on E (mod p):

  • p is the (mod p), as we have already seen in the original D–H algorithm.
  • a and b are the parameters of the curve.
  • G is the generator.
  • n is the order of G.
  • h is the cofactor.

Step 2: Crafting the shared key on E (mod p): [K]

After the parameter initialization, Alice and Bob will define the type of curve to adopt among the family of E (mod p):

Bob picks up a [β] private key such that 1 ≤ [β] ≤ n-1.

Alice picks up a [α] private key such that 1 ≤ [α] ≤ n-1.

After choosing random keys, Bob and Alice can compute their public keys.

Bob computes the following:

Alice computes the following:

Now (like in the original D–H algorithm), there is a generation of shared keys exchanging the public parameters:

  1. Bob sends B (xB and yB) to Alice.
  2. Alice receives B.
  3. Alice sends A (xA and yA) to Bob.
  4. Bob receives A.
  5. Bob computes the following:
  6. Alice computes the following:
  7. Finally, Bob and Alice hold the same information: the point on E: [K].

This point, [K], is the shared key between Alice and Bob.

Important Note

If Eve (the attacker) wants to know [K], she has to know [α] or [β], the private keys of Alice and Bob, respectively, given by the following functions:

B = [β] * G or A = [α] * G

To recover [K], Eve has to be able to solve the discrete logarithm on E (mod p), which, as we have seen, is a hard problem to solve.

A numerical example is as follows.

Let’s assume that the domain of the curve is the following:

Take a look at this E, plotted in Figure 7.5.

Figure 7.6 – The plotted curve used as an example to implement the D–H algorithm

Figure 7.5: The plotted curve used as an example to implement the D–H algorithm

The generator point is the following:

First of all, we have to find the order of the n curve.

To do that, we should calculate all the points until we reach the minimum integer that allows the cycling group.

So we start to calculate 2G.

Using the formula of the double point, we have the following:

Now that we have calculated (t), it’s possible to use it to find the x and y coordinates on the 2G curve:

So we have found the coordinates of 2G:

Now, we should go on to compute 3G, 4G, …, nG until we find the point of infinity, OG.

It is a lot of work to do it by hand, but it is also a good exercise to practice by yourself.

I will let you calculate all the scalar multiplications until the OG point, giving the results for some points:

This continues until it turns out that the point of infinity, OG, is the following:

This means that the order of G is the following:

So the parameters of E are the following:

Bob picks up Beta:

Alice picks up Alpha:

Bob calculates his public key (B):

Alice calculates her public key (A):

Alice sends (A) to Bob:

Bob sends (B) to Alice:

So as you can see, the shared key is [K] = (13,7).

The parameters used in the example are too small to be implemented in a real environment. In reality, the numbers have to be larger than the ones I have used in the preceding example. However, this algorithm is computationally easier than the original D–H one and can be used with smaller parameters and keys.

However, we have to rely on curves that are well-structured and architected by professional cryptographers and mathematicians.

Important Note

Implementing D–H on E (mod p) doesn’t necessarily prevent MitM attacks, just like in the original D–H algorithm (as seen in Chapter 3, Asymmetric Encryption Algorithms).

Now that we have more confidence in using the elliptic curve and its operations, we can go through an interesting elliptic curve case, analyzing the algorithm adopted for the Bitcoin digital signature ECDSA.

Elliptic curve secp256k1: the Bitcoin digital signature

Section titled “Elliptic curve secp256k1: the Bitcoin digital signature”

ECDSA is the digital signature scheme used in Bitcoin architecture that adopts an elliptic curve called secp256k1, standardized by the Standards for Efficient Cryptography Group (SECG).

ECDSA suggests (a = 0) and (b = 7) as parameters in the following equation:

For a more formal presentation, you can read the document reported by the SECG at https://www.secg.org/sec2-v2.pdf, where you can find the recommended parameters for the 256 bits associated with a Koblitz curve and the other bit-length sister curves.

This is the representation of secp256k1 in the real plane:

Figure 7.7 – secp256k1 elliptic curve

Figure 7.6: secp256k1 elliptic curve

As we know, the elliptic curve has a part visible in the real plane and another representation in the imaginary plane. The form of an elliptic curve can be represented in 3D by a torus when the points are defined in a finite field, just as you can see in the following figure:

Figure 7.8 – 3D representation of an elliptic curve in a finite field

Figure 7.7: 3D representation of an elliptic curve in a finite field

The secp256k1 curve is defined in the Z field as follows:

Alternatively, written in a different way, this is how it looks as an integer:

In this, the coordinates of the points are 256-bit integers in a big modulo p.

The secp256k1 curve was rarely used before the advent of Bitcoin. As you can imagine, after it was used for Bitcoin, it became popular. Unlike most of its counterparts, which commonly use a random structure, secp256k1 has been crafted to be more efficient. Indeed, if the implementation is optimized, this curve is 30% faster than others. Moreover, the constants (a and b) have been selected by the creator with a lower possibility of injecting a backdoor into it, which is different from the National Institute of Standards and Technology (NIST)’s other curves.

Finally, in secp256k1, the generator (G), the order (n), and the prime (modulo p) are not randomly chosen but are functions of other parameters. All that makes this curve one of the best you can implement, and it’s useful for the scope of digital signatures.

This is the reason why Bitcoin’s developers chose it. In Bitcoin, we will see precisely how many digits will be selected for the modulo (p), the order (n), and the base point (G) to make secp256k1 secure.

Let’s go on now to explore how the digital signature ECDSA algorithm is implemented in secp256k1.

The [d] private key is a number randomly chosen within the range 1 ≤ k ≤ n-1, where (n) is the order of G. This number has to be of a length of 256 bits so that it computes the hash value of the random number with SHA-256, which gives as output a 256-bit number. This is the way to be sure that the number is effectively 256 bits in length. Remember that if the output gives a number lower than (n-1), then the key will be accepted; if not, it will make another attempt.

The public key (Kpub) is derived by the following equation:

Thus, the number of possible private keys is the same as the order of G: n.

To calculate the public key (Q), starting from the private key, [d], in secp256k1, we have to use the following equation:

The result of the equation will be Q (the public key).

After this operation, we can switch to calculating the digital signature. Suppose that Alice is the sender of the signature and her [d], (G), and (Q) parameters have already been calculated. In a real case, Victor is the verifier (the miner) who has to verify the true ownership. Let’s go on to see how to sign a Bitcoin transaction in secp256k1.

Step 2: Performing the digital signature in secp256k1

Section titled “Step 2: Performing the digital signature in secp256k1”

Remember that to sign a document, [M], or, even better in this case, a value in Bitcoin, [B] (as we discussed in Chapter 4, Hash Functions and Digital Signatures), it is always recommended to compute Hash[B] = z.

So, we will sign (z), which is the hash of the message, and not [M] directly.

Another parameter that we need is [k], which is an ephemeral key (or session key).

The sub-steps to perform the digital signature (S) are similar to those for a public/private key algorithm. The difference here is that the discrete logarithm is obtained through a scalar multiplication:

  1. Alice chooses a random secret, [k], which gives us the following: [1≤ k ≤ n-1].
  2. She calculates the coordinates,.
  3. Alice finds (the x coordinate of R (x,y)).
  4. Alice calculates (this is the digital signature).

Alice sends the (r and S) pair to Victor for verification of the digital signature.

Victor receives the (r and S) pair. He can now verify whether (S) has really been performed by Alice.

To verify (S), Victor will follow this protocol:

  1. Check whether (r) and (S) are both included between 1 and (n-1).
  2. Calculate.
  3. Calculate.
  4. Calculate.
  5. Compute the point in secp256k1:.
  6. Verify that.

If (r) corresponds to Rx (mod n), the x coordinate of the R point, then the verifier accepts the signature (S) corresponding to the value of Bitcoin, [B], the owner of which claims to own the amount of Bitcoin declared.

Without the support of a practical example, it is rather difficult to understand such a complex protocol. Some of the operations performed on secp256k1 for the digital signature of a Bitcoin transaction are quite complex to interpret and need a practical example to understand. Indeed, in the next section, you will find an example that I hope will clarify many aspects of this protocol.

A numerical exercise on a digital signature on secp256k1

Section titled “A numerical exercise on a digital signature on secp256k1”

In this section, we will deep dive into the digital signature of secp256k1 in order to understand the mechanism behind the operations of implementation and validation of the digital signature.

Suppose, for instance, that the parameters of the curve are the following:

So, as we have chosen a very simple private key, it is just enough to perform a double point to obtain the public key (Q):

In this case, we proceed to calculate the public key (Q). First, we will use the following formula to calculate the double point:

Calculating Q = d * G using numbers implies replacing [d] and (G) with numbers:

Relying on the formula of the double point, let’s find the coordinates of Q (x and y), starting with x:

In the same way, let’s find the y coordinate of yQ:

So the coordinates of the public key (Q) are as follows:

Now, Alice can perform her digital signature (S).

First, Alice computes the H[M]= z hash.

Suppose that z = 17 is the hash of the [B] value of the Bitcoin.

Alice chooses a random secret number for the [k] session key:

Alice calculates the coordinates:

We have already calculated, so it’s possible to rely on the additional formula to calculate.

Let’s recall the formulas of point addition on elliptic curves:

To compute xR (the x coordinate of the R point), we have to solve this operation:

We seek [xR]:

Let’s consider the x coordinate of R:

At this point, we can perform the signature by applying the formula:

We have gained a very important point, the signature (S):

Alice sends the (S = 47, r = 62) pair to Victor.

To verify the digital signature, Victor receives

The public parameters that Victor has available are as follows:

First of all, Victor has to check the following:

Here we go: the signature passes the first check.

Victor now calculates (w), the inverse of the digital signature (S):

That, as we have already seen on several occasions, means the inverse functions of S (mod n) are performed:

Then, Victor calculates (U):

Now, Victor is able to verify the signature:

The game is not finished yet; we have to convert, through scalar multiplication, the coordinates of V = 3 on secp256k1.

To do that, we have to perform the following equation:

We will split the preceding equation into two parts: (UG) and (VQ). We start by calculating UG:

In order to reduce 76G through scalar multiplication, we have to perform six-point double (G) operations and two-point additions.

This shortcut will come in handy when the numbers are very large. There is no efficient algorithm able to perform such an operation of reduction like this, so we have to use our brains.

We already know the results of , so we can reformulate the preceding operations, , already calculated by me, and we arrive at this further reduction:

In the next step, we have to calculate .

One method to perform this scalar multiplication is first to calculate .

Then, we proceed to compute :

Finally, we can add to a unique adding point:

For the last verification, Victor can check the following:

In fact, it turns out as follows:

So finally, Victor accepts the signature!

We have seen how complex it is even if we use small numbers to delve inside this protocol, as demonstrated in this example. So you can imagine the enormous complexity that must be involved if the parameters are 256 bits or more. This elliptic curve is proposed to protect the ownership of Bitcoin. The signer, through their signature (S), can demonstrate that they own the [B] value corresponding to the computed hash (z).

It’s verified that secp256k1 is a particular elliptic curve, as we saw at the beginning of this section when I mentioned the characteristics of this curve, which, being different from others, is more efficient and has parameters chosen in a particular way to be implemented.

If you are curious about the implementation and the digital signature ECDSA algorithm, you can visit the NIST web page and the Institute of Electrical and Electronics Engineers (IEEE).

NIST has published a list of different kinds of ECC and the recommended parameters of the relative implementations. You can find the document at this link: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-78-4.pdf.

IEEE is a private organization dedicated to promoting publications, conferences, and standards. This organization released the IEEE P1363-2000 (Standards Specification for Public-Key Cryptography), where it is possible to find the specifications to implement the ECC.

In the next section, you will explore an attack against EDCSA private keys made by a hacker group calling itself fail0verflow, which announced it had recovered the secret keys used by Sony to sign in to the PlayStation 3. This attack worked because Sony didn’t properly implement ECDSA, using a static private key instead of a random one.

Attacks on ECDSA and the security of elliptic curves

Section titled “Attacks on ECDSA and the security of elliptic curves”

This attack on ECDSA can recover the private key, [d], if the random key (ephemeral key), [k], is not completely random or used multiple times to sign the hash of the message (z).

This attack, implemented to extract the signing key used for the PlayStation 3 gaming console in 2010, recovered the keys of more than 77 million accounts.

To better understand this disruptive attack (because it will recover not only the message but also the private key, [d]), we will divide it into two steps. In this example, we consider the case when two messages, [M] and [M1], are digitally signed using the same private keys, [k] and [d].

The signature (S = 47) generated at the time (t0) from the hash of the message, [M], as we know, is given by the following mathematical passages:

Here, it is presented in numbers:

Suppose now we know z1 = 23 (the hash of the second message, [M1]) transmitted at the time (t1) and generating the signature (S1). Moreover, we are supposed to know the second signature (S1) given by the equation:

Using the Reduce function of Mathematica, we have the following result for (S1):

where it is given that.

Tip

Reduce is a special function that allows us to factorize big modular numbers.

Substituting the parameters in the preceding equation with the numbers of our example, we can easily gain [k] using the Reduce modular function of Mathematica, as follows:

After we get [k], we can also gain the private key, [d].

Let’s see what happens in the next step.

After we have recovered the random key, [k], we can easily compute the private key, [d].

We know that (S) is given by the following equation:

Switching (k) from the denominator to the enumerator on the left side, we can write the equation in the following form:

From knowing (k) = 3, we can find [d] because also all the other parameters(S, z, and r) are public.

So we can find [d] by writing the previous equation as follows:

All the parameters on the right side are known.

We can write it out in numbers, as follows:

That is the number of the private key, [d]= 2, discovered!

Analyzing this attack, we come to a question: what happens if someone can find a method to generate multiple signatures (S1, S2, and Sn) starting from (z1, z2, and zn) or generate multiple signatures starting from (z)?

In other words, as (z) comes from the hash of the message (the value of Bitcoin recovered in a wallet) that we have called [B], what happens if we can generate an S1 signature starting from (z)?

I invite you to think about this question because if generating an S1 signature from (z) is possible, then it should be possible to generate multiple signatures on a single transaction, all verified by the receivers.

Let’s now see a brief analysis of ECC’s key strength compared to other encryptions. Elliptic curve efficiency compared with the classic public/private key cryptography algorithm is shown in the following table. You can immediately perceive the lowest key size used in elliptic curves compared to the Rivest-Shamir-Adleman (RSA) and Digital Signature Algorithm (DSA). The equivalence you see in the following figure also takes into consideration the symmetric scheme key size (for example, Advanced Encryption Standard (AES)), for example. This scheme is undoubtedly shorter than the elliptic curve, but since the elliptic curve can spread out digital signatures differently by symmetric scheme encryption, an effective comparison has to be done with asymmetric encryption:

Figure 7.9 – William Stallings’ table of comparison – ECC versus classical cryptography

Figure 7.8: William Stallings’ table of comparison, ECC versus classical cryptography

As you can see, 256-bit encryption performed on ECC is equivalent to a 3,072-bit key on RSA. Moreover, we can compare a 512-bit key on an elliptic curve to a key size on RSA of 15,360 bits. Compared with symmetric encryption (AES, for example), ECC needs double the amount of bits. This is a theoretical understanding of the comparative bit sizes between the algorithms.

When you get to the point of considering practical implementations, this should get you thinking about the computational power required by the algorithms.

Important Note

A warning regarding the key’s length: it doesn’t matter how long the modulus is or how big the key size is; if an algorithm logically breaks out, nothing will repair its defeat.

Now that we have seen how a practical attack on ECDSA works, one of the most interesting questions we should ask for the future is the following:

Is elliptic curve cryptography resistant to classical and quantum attacks?

At a glance, the answer could be that most elliptic curves are not vulnerable (if well implemented) to most traditional attacks, except for the same ones we find against the classic discrete logarithm (such as Pollard Rho or a birthday attack) and man-in-the-middle attacks in D–H ECC.

In the quantum case, however, Shor’s algorithm can probably solve the elliptic curve problem, as we will see in the next chapter, dedicated to quantum cryptography.

Thus, if someone asks: Are my Bitcoins secured for the next 10 or 20 years? We can answer, Under determinate conditions, yes, but if the beginning of the quantum-computing era generates enough qubits to break the classical discrete logarithm problem, it will probably break the ECC discrete logarithm problem in polynomial time too. So I agree with Jeremy Wohlwend (a Ph.D. candidate at MIT), who wrote the following in Elliptic Curve Cryptography: Pre and Post Quantum:

“Sadly, the day that quantum computers can work with a practical number of qubits will mark the end of ECC as we know it.”

In this chapter, we have analyzed some of the most used elliptic curves. We have seen what an elliptic curve is and how it is designed to be used in cryptography.

ECC has algorithms and protocols designed mainly to cover secrets related to public/private encryption systems, such as the D–H key exchange and the digital signature.

In particular, we analyzed the discrete logarithm problem transposed into ECC, so we have familiarized ourselves with the operations at the core of ECC, such as adding points to the curve and scalar multiplications.

These kinds of operations are quite different from the addition and multiplication we are familiar with; here, indeed, lies the strength of elliptic curves.

After the experimentation done on D–H ECC, we analyzed in detail secp256k1, which is the elliptic curve used to implement digital signatures on Bitcoin protocol through the ECDSA.

So now that you have learned about elliptic curves and systems as alternative methods in public/private encryption, you understand that one of the best properties of these curves is the grade of efficiency in their implementation, which can be a lower key size.

At the end of this chapter, we asked a question about ECC’s robustness regarding quantum attacks. It was with this answer that I introduced the topic of Chapter 9, Quantum Cryptography. This chapter will cover one of the most intriguing and bizarre topics of this book. Quantum computing and quantum cryptography will be the new challenge for cryptography’s future.