SlideShare a Scribd company logo
1 of 11
Download to read offline
An introduction to ECDSA and it’s use in Bitcoin
Hakeem Hunte
1358508
1 Introduction
"The secure system of verifying transactions that could transform the way we exchange goods and
services around the world" [11]. Bitcoin is a "peer-to-peer" decentralised cyrptocurrency initially
launched by Satoshi Nakamoto (alias) (2009) [8]. To “posses” a bitcoin means the holder of the bitcoin
has the capacity to transfer it to someone else whilst recording that particular transaction in the
blockchain. A blockchain is a record of all the transactions made using bitcoin. Effectively, anyone
who holds bitcoin also has a copy of the blockchain, making it near to impossible to forge transactions,
as each transaction has been signed and verified. This is implemented through the Elliptic Curve
Digital Signature Algorithm (ECDSA) [8]. To understand this monitored transaction of a bitcoin is
the focus of the project.
1.1 Introduction to Cryptography
Cryptography is related with the design of algorithms, primarily introduced to provide secrecy or
authenticity of messages [5]. Cryptography’s foundations lie in number theory, in which the first
tangible form was introduced by Ron Rivest, Adi Shamir and Len Adleman (RSA) in 1977, based on
the difficulty of factorizing an integer problem [3]. Bitcoin utilises the ECDSA, proposed by Scott
Vanston (1992) [2] as the foundations of signing and verifying transactions. ECDSA is based off of
Elliptic Curve Cryptography (ECC) which was presented by Victor S. Miller and Neal Koblitz in 1985
[6]. Bitcoin uses this mechanism, rather than RSA, as ECDSA have a more smaller key size, leading
to faster computations which overall is very beneficial for computing systems with limited processing
powers that want to optimize security [10].
The structure of the project is as follows: Firstly, we will gain an understanding of Public Key
Cryptography which underpins the ECDSA. Secondly, we will explore how the bitcoin system works,
in terms of the bitcoin wallet. Following this we will analyse elliptic curves, and how their features
are used in ECC, finally finishing the ECDSA.
2 Preliminary Defintions
We start with preliminary definitions in which would be useful throughout this project.
Definition 2.1. A hash function is a computable map f: x → h, from a large input x to a more
compact output h. It is also impractical to find two different inputs being x and z s.t. f(x) = f(z)
[10].
Definition 2.2. (Characteristic of field) Let K be a field. Let n ∈ N s.t n > 0. The smallest n > 0
s.t.
n · 1 = 1 + 1 + . . . + 1
n times
= 0,
1
3 PUBLIC KEY CRYPTOGRAPHIC SCHEMES 2
is called the characteristic of K.
Definition 2.3. Given a natural number n ≥ 2 and there exists a, b ∈ Z that have the same remainder
when divided by n then we say that a is congruent to b modulo n. This is denoted as a ≡ b (mod n) [10].
Definition 2.4. Let p be a prime number. The integers modulo p, consisting of the integers 0, 1, 2, .., p − 1
with addition multiplication performed modulo p, is a finite field of order p. This field is denoted as
Fp, where p is called the modulus of Fp [10].
Definition 2.5. A group G is a finite set of elements with a binary operation called addition denoted
+. For a set G to be called a group, it must satisfy the four properties if a, b ∈ G then [10]:
1. Closure. If a, b ∈ G then a + b ∈ G
2. Associativity. If a, b ∈ G then (a + b) + c = a + (b + c)
3. Identity. a ∈ G then a + 0 = a
4. inverse. If a, b ∈ G then for ever a there exists b s.t a + b = 0
Definition 2.6. A subgroup is a subset H of elements of a group G in which satisfies the four group
requirements [9].
3 Public Key Cryptographic Schemes
A public key scheme is when a key pair is selected and the task of acquiring the private key from the
public key is an arduous computational problem. The scheme consists of two keys: the public key,
which is seen by everybody, and the private key which can decrypt [5]. The main idea of this system
is that the holder of public key is unable to obtain the private key. So essentially, the cryptographic
function
f: P → C, (1)
is simple to calculate whilst having the encryption key KE. But, compartively it is extremely difficult
to calculate the reverse [10].
f−1
: C → P. (2)
4 How Bitcoins Work
4.1 Bitcoin wallet and address
For a user to use bitcoin, the user downloads an application in which serves as the wallet. This wallet
adopts public key cryptography based off elliptic curves explored later. In this case, the private key
is equivalent to a PIN number, enabling the user to access and authorise transactions. The public
key is equivalent to a bank account number derived through elliptic curve multiplication. When the
public key is combined with a cryptographic hash function1, the bitcoin address is produced. Each
address has it’s own balance of bitcoin, where transactions are fundamentally the exchange of bitcoin
(messages) between these adresses [8].
1
The cryptographic function used is the RIPEMD-160 hash
5 THE ELLIPTIC CURVE 3
Figure 1: The private key, public key and address [8]
4.2 The transactions
A transaction also contains digital a signature in which is provided as the proof of a transfer of bitcoin,
adding validity to the transaction. The owner of this bitcoin provides this digital signature utilising
their private key. This digital signature proves that they own these bitcoins and can then go on to
spend them in a new transaction. Following the verficiation of the digital signature, the transaction
can occur [8].
5 The Elliptic Curve
As stated earlier, the bitcoin wallet creates a public key and a private key to then verify transactions
[8]. The public key is mathematically acquired from the private key using the properties of elliptic
curves over a finite field. In this section we are going to explore elliptic curves over R and the finite
field along with their properties respectively. This will give us insight into how the features are used
in ECDSA.
Definition 5.1. Let K be a field of characteristic = 2, 3 and let x3 + ax + b where a, b ∈ K and does
not contain multiple roots. An elliptic curve E over K with the points (x, y) in which satisfy:
y2
= x3
+ Ax + B. (3)
5.1 Elliptic Curve over R
Definition 5.2. An elliptic curve E is the graph of an equation of the form
y2
= x3
+ Ax + B, (4)
where A, B ∈ Z, where 4A3 + 27B2 = 0. This condition is to ensure that the all points on the curve
are well defined. The point at infinity ∞ is also defined on the curve. At the top and bottom of the y
axis [6].
5.1.1 The group Law
This section describes the fundamental properties in which make the elliptic curve useful for cryptog-
raphy, we will first introduce them, then later in the project describe how the features are implemented.
Definition 5.3. The group Law. We define a group over Elliptic Curve E as
1. Elements of the group are points on an elliptic curve
2. Identity is the point infinity
5 THE ELLIPTIC CURVE 4
3. The inverse of a point P ∈ E is symmetric about the x axis
4. Addition of 3 aligned distinct points P, Q, R ∈ E is given as P + Q + R = 0.
We can write P + Q = −R , and from this we can derive the method for adding up two points on a
curve, which is crucial for point addition and point multiplication, explained later in the paper.
Case 1 Let P = (xp, yp) and −P = (xq, yq) where xp = xq but yp = yq, the line through P and −P
is vertical, therefore the line intersects E in ∞. Yielding P + (−P) = ∞.
Case 2 In the case Q = ∞. The line through the point P and ∞ is a vertical line, intersecting the
elliptic curve E at the point R, which is just a reflection of P across the x axis. Therefore P +∞ = R,
But we are back at P. Therefore P + ∞ = P
5.2 Point Addition demonstrated algebraically [6]
Case 3
Let P = (xp, yp) and Q = (xq, yq) and R = (xr, yr) s.t. P + Q = R. We assume that P, Q are points
on E, and that P and Q are distinct points We want to express R in terms of P and Q. We denote
the line (L) intersecting the two points P, Q has a slope m
m =
yp − yq
xp − xq
,
the equation of L then becomes
y = m(x − xp) + yp,
intersecting with the elliptic curve
(m(x − xp) + yp)2
= x3
+ Ax + B.
We rearrange this to then get
0 = x3
− m2
x2
+ . . . .
We already know two roots, being xp and xq, as P and Q are on the both E and L. We use the fact
that if we have a polynomial with roots r, s, t [6], then
x3
+ ax2
+ bx + c = (x − r)(x − s)(x − t) = x3
− (r + s + t)x2
+ . . .
Therefore we get,
r + s + t = −a.
Knowing the two roots r and s, we then get the third root as t = −a − r − s. So in our case we
get
x = m2
− xp − xq and yr = m(xp − xr) + yp.
Reflecting across the x axis we get the point R = (xr, yr)
xr = m2
− xp − xq and yr = m(xp − xr) − yp.
5.3 Point Doubling demonstrated algebraically [6]
Case 4 Consider the case P = Q = (xp, yp). As the two points on the curve are extremely close to
each other, the intercepting line of the points estimate a tangent line (L). The slope m of L is found
through implicit differentiation on equation (4) whereby:
2y
dy
dx
= 3x2
+ A, therefore m =
dy
dx
=
3x2
p + A
2yp
.
5 THE ELLIPTIC CURVE 5
Figure 2: Point addition over R Figure 3: Point doubling over R
We assume that yp = 0 The equation of L is:
y = m(x − xp) + yp,
we obtain the cubic equation
0 = x3
− m2
x2
+ . . . .
On this occasion, we know only one root, being xp, but this is a double root as L is a tangent to the
Elliptic Curve E at P, utilising the same technique earlier, obtaining:
xr = m2
− 2xp,
yr = m(xp − xr) − yp.
Definition 5.4. Let n ∈ Z, and P a point on a given Elliptic Curve E then
nP = P + P + . . . + P,
n times
(5)
is the operation on an Elliptic Curve called the scalar multiplication
Computing kP for a very large integer k can be an arduous task. It becomes inefficient to repeatedly
add P to itself [5]. Therefore the properties of point multiplication and point addition can be used.
This is called successive doubling can be used to speed this process, extremely critical when the
public key is computed. Taken an example from [16]: k = 23
23P = 2(2(2(2P) + P) + P) + P. (6)
5.4 Elliptic Curve over a Finite Field Fp
Elliptic Curve Cryptography makes use of Elliptic curves over finite fields, where all the variables and
coefficients are strictly within the finite field of size prime number p. Bitcoin uses elliptic curve curves
frequently in it’s systems, whereby calculating these arithmetic’s over the real numbers is infeasible
due to the inclusion of rational numbers. Standard computers do not have enough space to store all the
digits and compute these commands efficiently. An elliptic curve is graphically represented differently
over a finite field demonstrated in Figure 4. The operations are more difficult to see visually, but the
underlying arithmetic in which we derived for a Elliptic Curve over R still holds.
5 THE ELLIPTIC CURVE 6
Figure 4: Elliptic Curve in finite field [7] Figure 5: Point Multiplication [7]
Definition 5.5. Let p be a prime number, and let Fp denote the field of integers modulo p. An elliptic
curve E over Fp (E(Fp))is defined by an equation of the form
y2
= x3
+ ax + b. (7)
Where a, b ∈ Fp satisfy 4a3 + 27b2 ≡ 0 (mod p). This is to ensure the curve does not contain singu-
larities which in essence ensures that the elliptic curve is smooth and each point is defined. The point
at infinity, denoted by ∞, is also said to be on the curve.
Definition 5.6. E be an elliptic curve and kP, where k ∈ Z and P is a point on the elliptic curve
E defined over the field Fp with p being a prime number then we define (8) as the operation point
multiplication
kP = P + P + . . . + P.
k times
(8)
Point multiplication has interesting properties over the finite field exemplified in the following example.
This point multiplication operation dominates the execution time of many elliptic curve cryptographic
algorithms used to generate the public key [4].
Example 2 [14] Let E be the Elliptic Curve over Fp denoted as y2 ≡ x3 + 2x + 3 mod 97 and
the point G = (3, 6), then calculating the multiples using the features of point addition and
point doubling defined earlier we find that
0G = ∞, G = (3, 6), 2G = (80, 10), 3G = (80, 87), 4G = (3, 91)
5G = ∞, 6G = (3, 6), 7G = (80, 10), 8G = (80, 87), 9G = (3, 91) . . .
5.5 Order of Groups
In this section, we are going to understand the mathematics involved in forming the parameters used
in ECDSA. We are going to determine the size of the the subgroup of an Elliptic Curve over a finite
field, and understand the mathematics involved. Bitcoin uses a fixed set parameters for the ECDSA
algorithm, but this section is used to increase our understanding of how these parameters are formed.
The topic of counting points on an Elliptic Curve is extremely complex and beyond the scope of this
report, but to develop your understanding my recommended literature is Elliptic Curves - Number
Theory and Cryptography by Lawerence C. Washington.
5 THE ELLIPTIC CURVE 7
Definition 5.7. Let E be an elliptic curve defined over Fp. The number of points in E(Fp), denoted
#E(Fp), is called the order of E [9].
Definition 5.8. Let E be an elliptic curve over the finite field Fp. Then the order of E(Fp) satisfies
the following inequality (Hasse)
| p + 1 − #E(Fp) |≤ 2
√
p. (9)
Proof. Proof omitted see [5] p.46
Theorem 5.1. The points on an elliptic curve together will have cyclic subgroups. Under certain
conditions all points on an elliptic curve form a cyclic group [9].
Proof. Proof omitted
Definition 5.9. A group G which contains an element α with maximum order ord(α) = | G | is said
to be cyclic. Elements with the maximum order are called the Generator point [9].
Proof. Proof omitted
Definition 5.10. Let k ∈ Z and P ∈ E(Fp). We let P be the generator point. We denote the order of
P as the smallest positive integer k s.t. kP = ∞.
Proof. Proof omitted
With this being said determined from Example 2, we can observe that the order of the generator
point G is 5.
5.5.1 Subgroup order
To achieve maximum efficiency of the algorithm, and to determining the coefficients of the ECDSA,
it is important to determine the order of the subgroup generated by the generator point G. We are
going to need Lagrange’s Theorem, one of group theory’s first great discoveries. Lagrange’s Theorem
first appeared in 1770-1771, and was proven by the German mathematician Carl Friedrich Gauss in
1801 over the field Zp with p being a prime number. Proof from [15]
Lemma 5.2. We suppose that G is a group and H is a subgroup G. Let x, y ∈ G. Then the following
hold:
1. Suppose that h ∈ H. Then Hh = He = H, whereby e is the identity element of G.
2. y ∈ Hx i.f.f Hx = Hy
3. H(xy) = (Hx)y whereby (Hx)y = {wy | w ∈ Hx}
4. For ∀ h in H, Hhx = Hx
Definition 5.11. For a group G, a subset group H of G and each g ∈ G we define a left coset of H
in G as the set
gH = {gh | h ∈ H} (10)
Lemma 5.3. Suppose that G is a group and H ≤ G. We define a relation on G by x ∼ y ⇔ xy−1 ∈ H.
Then ∼ is an equivalence relation and the right cosets are the equivalence classes.
Lemma 5.4. Suppose H ≤ G. Then
1. for all x, y ∈ G, then either Hx ∩ Hy = ∅ or Hx = Hy and
6 ELLIPTIC CURVE CRYPTOGRAPHY 8
2. G = z∈H Hz
Lemma 5.5. Let G be a group G, and H be a subgroup of G and x ∈ G, the map
H −→ Hx, (11)
defined
h −→ hx, (12)
is a bijection. Resulting in | H |=| Hx |
Theorem 5.6. (Lagrange’s Theorem) Let G be a finite group.
1. Let H be a subgroup G. Then the order of H divides the order of G
2. Let g ∈ G. Then the order of g divides the order of G
Proof. Since the equivalence classes partition G, we find elements x1, x2, . . . , xr s.t.
G =
r
i=1
Hxi, (13)
whereby Hxi ∩ Hxj for i = j. The subsets of Hxi are disjoint. As the subsets are disjoint Lemma
4.2.1 gives
| G |=
r
i=1
Hxi =
r
i=1
| Hxi |=
r
i=1
| H |= r | H |, (14)
therefore, | G | is a multiple of | H | whenever H ≤ G, therefore the theorem is proved.
This is an important result, as it allows us to calculate the parameters used in ECDSA. With this said,
the larger the order of the sub-group of the finite field, the more difficult it is for the cryptosystem
to be infiltrated. Essentially, from knowing the order of the point, we can then calculate the group
order using (9). Strictly speaking, by finding a multiple of the group point within the Hasse’s Interval,
this value will equal #E(Fp). Relating to generating a hardy cryptosystem, a high order of a curve is
chosen, following this we choose a high divisor of this order, and then finally find a suitable generator
point which produces a cyclic subgroup order equal to the divisor. Taking an example from [4]:
Example Let E be the elliptic curve y2 = x3 − 10x + 21 over the finite field F557 The point
(2, 3) is shown to have order 189. Hasse’s Theorem suggests that 511 ≤ #E(Fp) ≤ 605 .
Calculating the multiples of 189 in this range is 3 · 189. Therefore #E(Fp) = 567.
6 Elliptic Curve Cryptography
After gaining understanding the use of cyclical subgroups and generator points, we are going to explore
the specific set of constraints in which bitcoin uses. Bitcoin uses a set of parameters defined in the
secp256k1 2 [1]. The elliptic curve y2 = x3 + Ax + B s.t.
a = 0000000000000000000000000000000000000000000000000000000000000000,
b = 0000000000000000000000000000000000000000000000000000000000000007,
defined over the prime finite field Fp, where
p = 2256 − 232 − 29 − 28 − 27 − 26 − 24 − 1.
2
secp256k1 refers to the parameters of the ECDSA curve used in Bitcoin, and is defined in Standards for Efficient
Cryptography (SEC)
6 ELLIPTIC CURVE CRYPTOGRAPHY 9
The generator point in compressed 3 form
G = 02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B
16F81798.
The order n of G
n = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE ABAAEDCE6 AF48A03B
BFD25E8C D0364141
and the cofactor h defined as #E(Fp)/n
h = 1.
As the generator point is specified within the parameters, and is constant for all bitcoin, the only point
in which changes is the unique point Q due to the change in the random integer d, as demonstrated
in the following subsection.
6.1 Key Generation
Before we introduce the ECDSA, we are going to understand Elliptic Curve Cryptography. Elliptic
Curve Cryptography was first proposed by Koblitz and Miller in 1985 [6]. We are going to investigate
the Elliptic Curve Discrete Logarithm Problem in which ECC it’s based from and then further our
understanding of how to create a public and private key used in ECDSA.
Definition 6.1. The Elliptic Curve Discrete logarithm Problem (ECDLP) Given an Elliptic Curve,
E represented as (4) defined over a finite field Fp of order n. We define the points, P and a point Q0
on E. The problem is defined to find k ∈ Z s.t. k ∈ [0, n − 1], s.t. Q0 = kP.
The resistance of the elliptic curve discrete logarithm problem is the foundations for all ECC schemes
[6]. The best algorithms to solve the problem having a running time of πn
2 steps.4 [6].
Firstly, a random private key is generated dA less than the order of the cyclic group and is of empirical
importance that the integer dA is random. The public key Q is generated by multiplying the generator
point G, dA number of times.
Q = dAG. (15)
Figure 6: Graphic representation of Point Multiplication of a generator point (G) [13]
Using the successive doubling method, it is comparatively simple to find Q from dA, however the
reverse is extremely difficult to compute, hence why the public key can be publicly shared without the
3
Further information on compressed points can be fouund at "http://bitcoin.stackexchange.com/questions/3059/what-
is-a-compressed-bitcoin-key"
4
The best algorithm to solve the ECDLP is the Pollard’s rho attack, with a total running time of πn
2
7 ECDSA 10
risk of the private key being exposed. A graphical example is demonstrated in Figure 6, where dA =5
and Q = 32G. Note that this is a simple example. Given dA is usually a very large number, we can
visualise it being extremely difficult to determine dA given only G and Q.
7 ECDSA
The Elliptic Curve Digital Signature Algorithm (ECDSA) is a representation of DSA, introduced in
1992 by Scott Vanston [2]. The ECDSA is defined by the parameters D = (p, a, b, G, n, h), in which
the bitcoin utilises secp256k1 standard parameters defined earlier. We also have a private and public
key pair, in which is generated the same way as (15).
Suppose Alice and Bob would send a message (i.e. transaction to each other), the following algorithm
demonstrates how a digital signature and verification would occur [8]. A hash function H is combined
with the message 5. The algorithm is referenced from [6].
Algorithm 1 ECDSA Signature Generation
Input :Domain parameter D = (p, a, b, G, n, h), secret key d , message m
Output Signature (r, s)
1: Select k ∈ [1, n − 1], k ∈ N
2: Compute kG = (x1, y1) s.t. x1 ∈ Z
3: Compute r = x1 mod n . If r=0, then return to step 1.
4: Compute e = H(m)
5: Compute s = k−1(e + dr) (mod n). If s=0 then go to step 1.
6: return (r, s).
Algorithm 2 ECDSA Signature Verification
Input: Domain parameter D = (p, a, b, G, n, h), public key Q, message m, signature (r, s)
Output: Acceptance of rejection of the signature
1: Verify 0 < r < n and 0 < s < n , if not you reject the signature
2: Compute e = H(m)
3: Compute w = s−1 mod n
4: Compute the two integers : u1 = we (mod n) and u2 = rw (mod n)
5: Compute the point X using the result of the computations : X = u1G + u2Q
6: If X = ∞ then you reject the signature
7: Convert the x co-ordinate of X, x1 to an integer v = x1 (mod n)
8: v = r, accept the signature
7.1 Proof of Correctness
Proof. If the signature (r, s) from the message m was created by a honest signee of the message. We
must then rearrange X to get
X = u1G + u2Q,
= u1G + u2dAG,
= G(u1 + u2dA),
5
The cryptographic function used is the ’Secure Hash Algorithm’
8 CONCLUSION 11
utilising the definitions of u1 and u2
X = G(u1 + u2dA),
= (s−1
e + s−1
rdA)G,
= s−1
(e + rdA)G,
= kG.
kG equates to the same point from Algorithm 1, step 2. This is the same point as only the x co-
ordinate was transmitted, with different equations, therefore v = r, demonstrating the signatures are
equal, verifying the transaction, concluding how we arrive at the algorithm ECDSA.
The decentralised and transparent system is further reinforced through the fact that any user on the
blockchain can verify whether the signature is authentic as only the public key is required.
8 Conclusion
In recent times, bitcoin and the block chain technology have been prevalent in the major financial
institutions in which financial institutions are exploring the option to streamline systems, potentially
slashing infrastructure costs [12]. This project was used to explore the mathematics behind these
secure transactions, gaining an understanding of the fundamentals behind the algorithm. ECDSA is
one of the adaptions of ECC, suggested as a substitute to other public cryptosystems such as RSA.
This project is served as an introduction to ECDSA and has looked under the bonnet of the algorithm.
With this said, hopefully the reader will have an enhanced knowledge of this.
References
[1] (March 30, 2015) [ONLINE] Avaliable from http://en.bitcoin.it/wiki/Secp256k1
[2] (March 16, 2016) [ONLINE] Avaliable from http://cs.ucsb.edu/ koc/ccs130h/notes/ecdsa-cert.pdf
[3] Arto Salomaa Public-Key Cryptography Springer-Verlag, 3-540-61356-0, 1996
[4] Lawrence C. Washington Elliptic Curves: Number Theory and Cryptography Chapman & Hall, 1-58488-365-0, 2003
[5] Hans Delfs & Helmut Knebl Introduction to Cryptography: Principles and Applications Springer, 3-540-42278-1, 2002
[6] Darrel Hankerson, Alfred Menezes, Scott Vanstone Guide to Elliptic Curve Cryptography Springer-Verlag, 0-387-95273-X,
2004
[7] Pedro Franco Understanding Bitcoin- Cryptography, Engineering and Economics John Wiley & Sons, 978-1119019169, 20014
[8] Andreas M. Antonopoulos Mastering Bitcoin- Unlocking Digital Crypto-currency O’Reilly Media, 978-1-449-37404-4, 2010
[9] Christof Paarm Jan Petzel Understanding Cryptography- A textbooks for Student and Practitioners Springer, 978-3-642-44649-
8, 2010
[10] Neal Koblitz A Course in Number Theory and Cryptography Springer-Verlag, 0-387-94293-9, 1948
[11] Hodson, Hal "Bitcoin moves beyond money". New Scientist, 2013, Vol.220(2945): pp.24-24. Print.
[12] Jane Wild, Martin Arnold and Philip Stafford (November 1, 2015) [ONLINE] Avaliable at
http://www.ft.com/cms/s/2/eb1f8256-7b4b-11e5-a1fe-567b37f80b64.html#axzz42EcFPVJX
[13] CryptoBond, (2016), Elliptic Curve over finite field [ONLINE]. Available at:
https://www.cryptocompare.com/wallets/guides/what-is-elliptic-curve-cryptography/ [Accessed 22 March 16].
[14] Andrea Corbellini, (2015), Elliptic Curve Cryptography: a gentle introduction [ONLINE]. Available at:
http://andrea.corbellini.name/2015/05/17/elliptic-curve-cryptography-a-gentle-introduction/ [Accessed 22
March 16].
[15] Christopher Parker, (2016), SYMMETRY AND GROUPS. Available at: University of Birmingham, Edgbaston,
Birmingham B15 2TT [Accessed 19 March 16].
[16] Hero Modares, Yasser Salem, Rosli Salleh and Majid T. Shahgoli "A Bit-Serial Multiplier Architecture for Finite Fields Over
Galois Fields". J. Comput. Sci, 2010, Vol.220(2945): 6: 1237-1246.

More Related Content

What's hot

Linear Cryptanalysis Lecture 線形解読法
Linear Cryptanalysis Lecture 線形解読法Linear Cryptanalysis Lecture 線形解読法
Linear Cryptanalysis Lecture 線形解読法Kai Katsumata
 
Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]
Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]
Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]Ghins GO
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve CryptographyKelly Bresnahan
 
An Introduction to Coding Theory
An Introduction to Coding TheoryAn Introduction to Coding Theory
An Introduction to Coding TheoryAlexanderWei11
 
The International Journal of Engineering and Science
The International Journal of Engineering and ScienceThe International Journal of Engineering and Science
The International Journal of Engineering and Sciencetheijes
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysOn the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysDharmalingam Ganesan
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..Madhumita Tamhane
 
Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsemGopi Saiteja
 
Ijarcet vol-2-issue-7-2323-2327
Ijarcet vol-2-issue-7-2323-2327Ijarcet vol-2-issue-7-2323-2327
Ijarcet vol-2-issue-7-2323-2327Editor IJARCET
 
Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...
Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...
Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...Marisa Paryasto
 
Social Network Analysis
Social Network AnalysisSocial Network Analysis
Social Network Analysisrik0
 
Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...
Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...
Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...Editor IJCATR
 
Review session2
Review session2Review session2
Review session2NEEDY12345
 

What's hot (18)

Active Attacks on DH Key Exchange
Active Attacks on DH Key ExchangeActive Attacks on DH Key Exchange
Active Attacks on DH Key Exchange
 
Linear Cryptanalysis Lecture 線形解読法
Linear Cryptanalysis Lecture 線形解読法Linear Cryptanalysis Lecture 線形解読法
Linear Cryptanalysis Lecture 線形解読法
 
Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]
Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]
Aplikasi Bilangan Kompleks - Analisis Sinyal [PAPER]
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 
An Introduction to Coding Theory
An Introduction to Coding TheoryAn Introduction to Coding Theory
An Introduction to Coding Theory
 
Elliptic curvecryptography Shane Almeida Saqib Awan Dan Palacio
Elliptic curvecryptography Shane Almeida Saqib Awan Dan PalacioElliptic curvecryptography Shane Almeida Saqib Awan Dan Palacio
Elliptic curvecryptography Shane Almeida Saqib Awan Dan Palacio
 
The International Journal of Engineering and Science
The International Journal of Engineering and ScienceThe International Journal of Engineering and Science
The International Journal of Engineering and Science
 
Lec16
Lec16Lec16
Lec16
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysOn the Secrecy of RSA Private Keys
On the Secrecy of RSA Private Keys
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..
 
G029037043
G029037043G029037043
G029037043
 
NCCU CPDA Lecture 12 Attribute Based Encryption
NCCU CPDA Lecture 12 Attribute Based EncryptionNCCU CPDA Lecture 12 Attribute Based Encryption
NCCU CPDA Lecture 12 Attribute Based Encryption
 
Ee693 sept2014midsem
Ee693 sept2014midsemEe693 sept2014midsem
Ee693 sept2014midsem
 
Ijarcet vol-2-issue-7-2323-2327
Ijarcet vol-2-issue-7-2323-2327Ijarcet vol-2-issue-7-2323-2327
Ijarcet vol-2-issue-7-2323-2327
 
Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...
Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...
Composite Field Multiplier based on Look-Up Table for Elliptic Curve Cryptogr...
 
Social Network Analysis
Social Network AnalysisSocial Network Analysis
Social Network Analysis
 
Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...
Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...
Ijcatr03051008Implementation of Matrix based Mapping Method Using Elliptic Cu...
 
Review session2
Review session2Review session2
Review session2
 

Similar to An Introduction to ECDSA and it's use in Bitcoin (1)

elliptic-curves-modern
elliptic-curves-modernelliptic-curves-modern
elliptic-curves-modernEric Seifert
 
Novel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsaNovel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsaSoham Mondal
 
Convolution presentation
Convolution presentationConvolution presentation
Convolution presentationSoham Mondal
 
Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...
Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...
Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...ijceronline
 
A SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTS
A SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTSA SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTS
A SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTScsandit
 
International Journal of Computational Engineering Research(IJCER)
 International Journal of Computational Engineering Research(IJCER)  International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER) ijceronline
 
Elliptic Curves as Tool for Public Key Cryptography
Elliptic Curves as Tool for Public Key CryptographyElliptic Curves as Tool for Public Key Cryptography
Elliptic Curves as Tool for Public Key Cryptographyinventy
 
Low Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve CryptographyLow Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve CryptographyIOSR Journals
 
Low Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve CryptographyLow Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve CryptographyIOSR Journals
 
An ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
An ElGamal Encryption Scheme of Adjacency Matrix and Finite MachinesAn ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
An ElGamal Encryption Scheme of Adjacency Matrix and Finite MachinesComputer Science Journals
 
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHYAUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHYijujournal
 
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHYAUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHYijujournal
 
Assignment 2 (1) (1).docx
Assignment 2 (1) (1).docxAssignment 2 (1) (1).docx
Assignment 2 (1) (1).docxpinstechwork
 
Matlab polynimials and curve fitting
Matlab polynimials and curve fittingMatlab polynimials and curve fitting
Matlab polynimials and curve fittingAmeen San
 
Survey ecc 09june12
Survey ecc 09june12Survey ecc 09june12
Survey ecc 09june12IJASCSE
 
Public Key Cryptography
Public Key CryptographyPublic Key Cryptography
Public Key CryptographyAbhijit Mondal
 

Similar to An Introduction to ECDSA and it's use in Bitcoin (1) (20)

elliptic-curves-modern
elliptic-curves-modernelliptic-curves-modern
elliptic-curves-modern
 
Novel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsaNovel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsa
 
Convolution presentation
Convolution presentationConvolution presentation
Convolution presentation
 
Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...
Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...
Implementation of Elliptic Curve Digital Signature Algorithm Using Variable T...
 
A SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTS
A SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTSA SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTS
A SURVEY ON ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM AND ITS VARIANTS
 
International Journal of Computational Engineering Research(IJCER)
 International Journal of Computational Engineering Research(IJCER)  International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Elliptic Curves as Tool for Public Key Cryptography
Elliptic Curves as Tool for Public Key CryptographyElliptic Curves as Tool for Public Key Cryptography
Elliptic Curves as Tool for Public Key Cryptography
 
1508.07756v1
1508.07756v11508.07756v1
1508.07756v1
 
Low Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve CryptographyLow Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve Cryptography
 
Low Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve CryptographyLow Power FPGA Based Elliptical Curve Cryptography
Low Power FPGA Based Elliptical Curve Cryptography
 
An ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
An ElGamal Encryption Scheme of Adjacency Matrix and Finite MachinesAn ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
An ElGamal Encryption Scheme of Adjacency Matrix and Finite Machines
 
Lecture50
Lecture50Lecture50
Lecture50
 
Mgm
MgmMgm
Mgm
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryption
 
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHYAUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
 
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHYAUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
AUTHENTICATED PUBLIC KEY ENCRYPTION SCHEME USING ELLIPTIC CURVE CRYPTOGRAPHY
 
Assignment 2 (1) (1).docx
Assignment 2 (1) (1).docxAssignment 2 (1) (1).docx
Assignment 2 (1) (1).docx
 
Matlab polynimials and curve fitting
Matlab polynimials and curve fittingMatlab polynimials and curve fitting
Matlab polynimials and curve fitting
 
Survey ecc 09june12
Survey ecc 09june12Survey ecc 09june12
Survey ecc 09june12
 
Public Key Cryptography
Public Key CryptographyPublic Key Cryptography
Public Key Cryptography
 

An Introduction to ECDSA and it's use in Bitcoin (1)

  • 1. An introduction to ECDSA and it’s use in Bitcoin Hakeem Hunte 1358508 1 Introduction "The secure system of verifying transactions that could transform the way we exchange goods and services around the world" [11]. Bitcoin is a "peer-to-peer" decentralised cyrptocurrency initially launched by Satoshi Nakamoto (alias) (2009) [8]. To “posses” a bitcoin means the holder of the bitcoin has the capacity to transfer it to someone else whilst recording that particular transaction in the blockchain. A blockchain is a record of all the transactions made using bitcoin. Effectively, anyone who holds bitcoin also has a copy of the blockchain, making it near to impossible to forge transactions, as each transaction has been signed and verified. This is implemented through the Elliptic Curve Digital Signature Algorithm (ECDSA) [8]. To understand this monitored transaction of a bitcoin is the focus of the project. 1.1 Introduction to Cryptography Cryptography is related with the design of algorithms, primarily introduced to provide secrecy or authenticity of messages [5]. Cryptography’s foundations lie in number theory, in which the first tangible form was introduced by Ron Rivest, Adi Shamir and Len Adleman (RSA) in 1977, based on the difficulty of factorizing an integer problem [3]. Bitcoin utilises the ECDSA, proposed by Scott Vanston (1992) [2] as the foundations of signing and verifying transactions. ECDSA is based off of Elliptic Curve Cryptography (ECC) which was presented by Victor S. Miller and Neal Koblitz in 1985 [6]. Bitcoin uses this mechanism, rather than RSA, as ECDSA have a more smaller key size, leading to faster computations which overall is very beneficial for computing systems with limited processing powers that want to optimize security [10]. The structure of the project is as follows: Firstly, we will gain an understanding of Public Key Cryptography which underpins the ECDSA. Secondly, we will explore how the bitcoin system works, in terms of the bitcoin wallet. Following this we will analyse elliptic curves, and how their features are used in ECC, finally finishing the ECDSA. 2 Preliminary Defintions We start with preliminary definitions in which would be useful throughout this project. Definition 2.1. A hash function is a computable map f: x → h, from a large input x to a more compact output h. It is also impractical to find two different inputs being x and z s.t. f(x) = f(z) [10]. Definition 2.2. (Characteristic of field) Let K be a field. Let n ∈ N s.t n > 0. The smallest n > 0 s.t. n · 1 = 1 + 1 + . . . + 1 n times = 0, 1
  • 2. 3 PUBLIC KEY CRYPTOGRAPHIC SCHEMES 2 is called the characteristic of K. Definition 2.3. Given a natural number n ≥ 2 and there exists a, b ∈ Z that have the same remainder when divided by n then we say that a is congruent to b modulo n. This is denoted as a ≡ b (mod n) [10]. Definition 2.4. Let p be a prime number. The integers modulo p, consisting of the integers 0, 1, 2, .., p − 1 with addition multiplication performed modulo p, is a finite field of order p. This field is denoted as Fp, where p is called the modulus of Fp [10]. Definition 2.5. A group G is a finite set of elements with a binary operation called addition denoted +. For a set G to be called a group, it must satisfy the four properties if a, b ∈ G then [10]: 1. Closure. If a, b ∈ G then a + b ∈ G 2. Associativity. If a, b ∈ G then (a + b) + c = a + (b + c) 3. Identity. a ∈ G then a + 0 = a 4. inverse. If a, b ∈ G then for ever a there exists b s.t a + b = 0 Definition 2.6. A subgroup is a subset H of elements of a group G in which satisfies the four group requirements [9]. 3 Public Key Cryptographic Schemes A public key scheme is when a key pair is selected and the task of acquiring the private key from the public key is an arduous computational problem. The scheme consists of two keys: the public key, which is seen by everybody, and the private key which can decrypt [5]. The main idea of this system is that the holder of public key is unable to obtain the private key. So essentially, the cryptographic function f: P → C, (1) is simple to calculate whilst having the encryption key KE. But, compartively it is extremely difficult to calculate the reverse [10]. f−1 : C → P. (2) 4 How Bitcoins Work 4.1 Bitcoin wallet and address For a user to use bitcoin, the user downloads an application in which serves as the wallet. This wallet adopts public key cryptography based off elliptic curves explored later. In this case, the private key is equivalent to a PIN number, enabling the user to access and authorise transactions. The public key is equivalent to a bank account number derived through elliptic curve multiplication. When the public key is combined with a cryptographic hash function1, the bitcoin address is produced. Each address has it’s own balance of bitcoin, where transactions are fundamentally the exchange of bitcoin (messages) between these adresses [8]. 1 The cryptographic function used is the RIPEMD-160 hash
  • 3. 5 THE ELLIPTIC CURVE 3 Figure 1: The private key, public key and address [8] 4.2 The transactions A transaction also contains digital a signature in which is provided as the proof of a transfer of bitcoin, adding validity to the transaction. The owner of this bitcoin provides this digital signature utilising their private key. This digital signature proves that they own these bitcoins and can then go on to spend them in a new transaction. Following the verficiation of the digital signature, the transaction can occur [8]. 5 The Elliptic Curve As stated earlier, the bitcoin wallet creates a public key and a private key to then verify transactions [8]. The public key is mathematically acquired from the private key using the properties of elliptic curves over a finite field. In this section we are going to explore elliptic curves over R and the finite field along with their properties respectively. This will give us insight into how the features are used in ECDSA. Definition 5.1. Let K be a field of characteristic = 2, 3 and let x3 + ax + b where a, b ∈ K and does not contain multiple roots. An elliptic curve E over K with the points (x, y) in which satisfy: y2 = x3 + Ax + B. (3) 5.1 Elliptic Curve over R Definition 5.2. An elliptic curve E is the graph of an equation of the form y2 = x3 + Ax + B, (4) where A, B ∈ Z, where 4A3 + 27B2 = 0. This condition is to ensure that the all points on the curve are well defined. The point at infinity ∞ is also defined on the curve. At the top and bottom of the y axis [6]. 5.1.1 The group Law This section describes the fundamental properties in which make the elliptic curve useful for cryptog- raphy, we will first introduce them, then later in the project describe how the features are implemented. Definition 5.3. The group Law. We define a group over Elliptic Curve E as 1. Elements of the group are points on an elliptic curve 2. Identity is the point infinity
  • 4. 5 THE ELLIPTIC CURVE 4 3. The inverse of a point P ∈ E is symmetric about the x axis 4. Addition of 3 aligned distinct points P, Q, R ∈ E is given as P + Q + R = 0. We can write P + Q = −R , and from this we can derive the method for adding up two points on a curve, which is crucial for point addition and point multiplication, explained later in the paper. Case 1 Let P = (xp, yp) and −P = (xq, yq) where xp = xq but yp = yq, the line through P and −P is vertical, therefore the line intersects E in ∞. Yielding P + (−P) = ∞. Case 2 In the case Q = ∞. The line through the point P and ∞ is a vertical line, intersecting the elliptic curve E at the point R, which is just a reflection of P across the x axis. Therefore P +∞ = R, But we are back at P. Therefore P + ∞ = P 5.2 Point Addition demonstrated algebraically [6] Case 3 Let P = (xp, yp) and Q = (xq, yq) and R = (xr, yr) s.t. P + Q = R. We assume that P, Q are points on E, and that P and Q are distinct points We want to express R in terms of P and Q. We denote the line (L) intersecting the two points P, Q has a slope m m = yp − yq xp − xq , the equation of L then becomes y = m(x − xp) + yp, intersecting with the elliptic curve (m(x − xp) + yp)2 = x3 + Ax + B. We rearrange this to then get 0 = x3 − m2 x2 + . . . . We already know two roots, being xp and xq, as P and Q are on the both E and L. We use the fact that if we have a polynomial with roots r, s, t [6], then x3 + ax2 + bx + c = (x − r)(x − s)(x − t) = x3 − (r + s + t)x2 + . . . Therefore we get, r + s + t = −a. Knowing the two roots r and s, we then get the third root as t = −a − r − s. So in our case we get x = m2 − xp − xq and yr = m(xp − xr) + yp. Reflecting across the x axis we get the point R = (xr, yr) xr = m2 − xp − xq and yr = m(xp − xr) − yp. 5.3 Point Doubling demonstrated algebraically [6] Case 4 Consider the case P = Q = (xp, yp). As the two points on the curve are extremely close to each other, the intercepting line of the points estimate a tangent line (L). The slope m of L is found through implicit differentiation on equation (4) whereby: 2y dy dx = 3x2 + A, therefore m = dy dx = 3x2 p + A 2yp .
  • 5. 5 THE ELLIPTIC CURVE 5 Figure 2: Point addition over R Figure 3: Point doubling over R We assume that yp = 0 The equation of L is: y = m(x − xp) + yp, we obtain the cubic equation 0 = x3 − m2 x2 + . . . . On this occasion, we know only one root, being xp, but this is a double root as L is a tangent to the Elliptic Curve E at P, utilising the same technique earlier, obtaining: xr = m2 − 2xp, yr = m(xp − xr) − yp. Definition 5.4. Let n ∈ Z, and P a point on a given Elliptic Curve E then nP = P + P + . . . + P, n times (5) is the operation on an Elliptic Curve called the scalar multiplication Computing kP for a very large integer k can be an arduous task. It becomes inefficient to repeatedly add P to itself [5]. Therefore the properties of point multiplication and point addition can be used. This is called successive doubling can be used to speed this process, extremely critical when the public key is computed. Taken an example from [16]: k = 23 23P = 2(2(2(2P) + P) + P) + P. (6) 5.4 Elliptic Curve over a Finite Field Fp Elliptic Curve Cryptography makes use of Elliptic curves over finite fields, where all the variables and coefficients are strictly within the finite field of size prime number p. Bitcoin uses elliptic curve curves frequently in it’s systems, whereby calculating these arithmetic’s over the real numbers is infeasible due to the inclusion of rational numbers. Standard computers do not have enough space to store all the digits and compute these commands efficiently. An elliptic curve is graphically represented differently over a finite field demonstrated in Figure 4. The operations are more difficult to see visually, but the underlying arithmetic in which we derived for a Elliptic Curve over R still holds.
  • 6. 5 THE ELLIPTIC CURVE 6 Figure 4: Elliptic Curve in finite field [7] Figure 5: Point Multiplication [7] Definition 5.5. Let p be a prime number, and let Fp denote the field of integers modulo p. An elliptic curve E over Fp (E(Fp))is defined by an equation of the form y2 = x3 + ax + b. (7) Where a, b ∈ Fp satisfy 4a3 + 27b2 ≡ 0 (mod p). This is to ensure the curve does not contain singu- larities which in essence ensures that the elliptic curve is smooth and each point is defined. The point at infinity, denoted by ∞, is also said to be on the curve. Definition 5.6. E be an elliptic curve and kP, where k ∈ Z and P is a point on the elliptic curve E defined over the field Fp with p being a prime number then we define (8) as the operation point multiplication kP = P + P + . . . + P. k times (8) Point multiplication has interesting properties over the finite field exemplified in the following example. This point multiplication operation dominates the execution time of many elliptic curve cryptographic algorithms used to generate the public key [4]. Example 2 [14] Let E be the Elliptic Curve over Fp denoted as y2 ≡ x3 + 2x + 3 mod 97 and the point G = (3, 6), then calculating the multiples using the features of point addition and point doubling defined earlier we find that 0G = ∞, G = (3, 6), 2G = (80, 10), 3G = (80, 87), 4G = (3, 91) 5G = ∞, 6G = (3, 6), 7G = (80, 10), 8G = (80, 87), 9G = (3, 91) . . . 5.5 Order of Groups In this section, we are going to understand the mathematics involved in forming the parameters used in ECDSA. We are going to determine the size of the the subgroup of an Elliptic Curve over a finite field, and understand the mathematics involved. Bitcoin uses a fixed set parameters for the ECDSA algorithm, but this section is used to increase our understanding of how these parameters are formed. The topic of counting points on an Elliptic Curve is extremely complex and beyond the scope of this report, but to develop your understanding my recommended literature is Elliptic Curves - Number Theory and Cryptography by Lawerence C. Washington.
  • 7. 5 THE ELLIPTIC CURVE 7 Definition 5.7. Let E be an elliptic curve defined over Fp. The number of points in E(Fp), denoted #E(Fp), is called the order of E [9]. Definition 5.8. Let E be an elliptic curve over the finite field Fp. Then the order of E(Fp) satisfies the following inequality (Hasse) | p + 1 − #E(Fp) |≤ 2 √ p. (9) Proof. Proof omitted see [5] p.46 Theorem 5.1. The points on an elliptic curve together will have cyclic subgroups. Under certain conditions all points on an elliptic curve form a cyclic group [9]. Proof. Proof omitted Definition 5.9. A group G which contains an element α with maximum order ord(α) = | G | is said to be cyclic. Elements with the maximum order are called the Generator point [9]. Proof. Proof omitted Definition 5.10. Let k ∈ Z and P ∈ E(Fp). We let P be the generator point. We denote the order of P as the smallest positive integer k s.t. kP = ∞. Proof. Proof omitted With this being said determined from Example 2, we can observe that the order of the generator point G is 5. 5.5.1 Subgroup order To achieve maximum efficiency of the algorithm, and to determining the coefficients of the ECDSA, it is important to determine the order of the subgroup generated by the generator point G. We are going to need Lagrange’s Theorem, one of group theory’s first great discoveries. Lagrange’s Theorem first appeared in 1770-1771, and was proven by the German mathematician Carl Friedrich Gauss in 1801 over the field Zp with p being a prime number. Proof from [15] Lemma 5.2. We suppose that G is a group and H is a subgroup G. Let x, y ∈ G. Then the following hold: 1. Suppose that h ∈ H. Then Hh = He = H, whereby e is the identity element of G. 2. y ∈ Hx i.f.f Hx = Hy 3. H(xy) = (Hx)y whereby (Hx)y = {wy | w ∈ Hx} 4. For ∀ h in H, Hhx = Hx Definition 5.11. For a group G, a subset group H of G and each g ∈ G we define a left coset of H in G as the set gH = {gh | h ∈ H} (10) Lemma 5.3. Suppose that G is a group and H ≤ G. We define a relation on G by x ∼ y ⇔ xy−1 ∈ H. Then ∼ is an equivalence relation and the right cosets are the equivalence classes. Lemma 5.4. Suppose H ≤ G. Then 1. for all x, y ∈ G, then either Hx ∩ Hy = ∅ or Hx = Hy and
  • 8. 6 ELLIPTIC CURVE CRYPTOGRAPHY 8 2. G = z∈H Hz Lemma 5.5. Let G be a group G, and H be a subgroup of G and x ∈ G, the map H −→ Hx, (11) defined h −→ hx, (12) is a bijection. Resulting in | H |=| Hx | Theorem 5.6. (Lagrange’s Theorem) Let G be a finite group. 1. Let H be a subgroup G. Then the order of H divides the order of G 2. Let g ∈ G. Then the order of g divides the order of G Proof. Since the equivalence classes partition G, we find elements x1, x2, . . . , xr s.t. G = r i=1 Hxi, (13) whereby Hxi ∩ Hxj for i = j. The subsets of Hxi are disjoint. As the subsets are disjoint Lemma 4.2.1 gives | G |= r i=1 Hxi = r i=1 | Hxi |= r i=1 | H |= r | H |, (14) therefore, | G | is a multiple of | H | whenever H ≤ G, therefore the theorem is proved. This is an important result, as it allows us to calculate the parameters used in ECDSA. With this said, the larger the order of the sub-group of the finite field, the more difficult it is for the cryptosystem to be infiltrated. Essentially, from knowing the order of the point, we can then calculate the group order using (9). Strictly speaking, by finding a multiple of the group point within the Hasse’s Interval, this value will equal #E(Fp). Relating to generating a hardy cryptosystem, a high order of a curve is chosen, following this we choose a high divisor of this order, and then finally find a suitable generator point which produces a cyclic subgroup order equal to the divisor. Taking an example from [4]: Example Let E be the elliptic curve y2 = x3 − 10x + 21 over the finite field F557 The point (2, 3) is shown to have order 189. Hasse’s Theorem suggests that 511 ≤ #E(Fp) ≤ 605 . Calculating the multiples of 189 in this range is 3 · 189. Therefore #E(Fp) = 567. 6 Elliptic Curve Cryptography After gaining understanding the use of cyclical subgroups and generator points, we are going to explore the specific set of constraints in which bitcoin uses. Bitcoin uses a set of parameters defined in the secp256k1 2 [1]. The elliptic curve y2 = x3 + Ax + B s.t. a = 0000000000000000000000000000000000000000000000000000000000000000, b = 0000000000000000000000000000000000000000000000000000000000000007, defined over the prime finite field Fp, where p = 2256 − 232 − 29 − 28 − 27 − 26 − 24 − 1. 2 secp256k1 refers to the parameters of the ECDSA curve used in Bitcoin, and is defined in Standards for Efficient Cryptography (SEC)
  • 9. 6 ELLIPTIC CURVE CRYPTOGRAPHY 9 The generator point in compressed 3 form G = 02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798. The order n of G n = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE ABAAEDCE6 AF48A03B BFD25E8C D0364141 and the cofactor h defined as #E(Fp)/n h = 1. As the generator point is specified within the parameters, and is constant for all bitcoin, the only point in which changes is the unique point Q due to the change in the random integer d, as demonstrated in the following subsection. 6.1 Key Generation Before we introduce the ECDSA, we are going to understand Elliptic Curve Cryptography. Elliptic Curve Cryptography was first proposed by Koblitz and Miller in 1985 [6]. We are going to investigate the Elliptic Curve Discrete Logarithm Problem in which ECC it’s based from and then further our understanding of how to create a public and private key used in ECDSA. Definition 6.1. The Elliptic Curve Discrete logarithm Problem (ECDLP) Given an Elliptic Curve, E represented as (4) defined over a finite field Fp of order n. We define the points, P and a point Q0 on E. The problem is defined to find k ∈ Z s.t. k ∈ [0, n − 1], s.t. Q0 = kP. The resistance of the elliptic curve discrete logarithm problem is the foundations for all ECC schemes [6]. The best algorithms to solve the problem having a running time of πn 2 steps.4 [6]. Firstly, a random private key is generated dA less than the order of the cyclic group and is of empirical importance that the integer dA is random. The public key Q is generated by multiplying the generator point G, dA number of times. Q = dAG. (15) Figure 6: Graphic representation of Point Multiplication of a generator point (G) [13] Using the successive doubling method, it is comparatively simple to find Q from dA, however the reverse is extremely difficult to compute, hence why the public key can be publicly shared without the 3 Further information on compressed points can be fouund at "http://bitcoin.stackexchange.com/questions/3059/what- is-a-compressed-bitcoin-key" 4 The best algorithm to solve the ECDLP is the Pollard’s rho attack, with a total running time of πn 2
  • 10. 7 ECDSA 10 risk of the private key being exposed. A graphical example is demonstrated in Figure 6, where dA =5 and Q = 32G. Note that this is a simple example. Given dA is usually a very large number, we can visualise it being extremely difficult to determine dA given only G and Q. 7 ECDSA The Elliptic Curve Digital Signature Algorithm (ECDSA) is a representation of DSA, introduced in 1992 by Scott Vanston [2]. The ECDSA is defined by the parameters D = (p, a, b, G, n, h), in which the bitcoin utilises secp256k1 standard parameters defined earlier. We also have a private and public key pair, in which is generated the same way as (15). Suppose Alice and Bob would send a message (i.e. transaction to each other), the following algorithm demonstrates how a digital signature and verification would occur [8]. A hash function H is combined with the message 5. The algorithm is referenced from [6]. Algorithm 1 ECDSA Signature Generation Input :Domain parameter D = (p, a, b, G, n, h), secret key d , message m Output Signature (r, s) 1: Select k ∈ [1, n − 1], k ∈ N 2: Compute kG = (x1, y1) s.t. x1 ∈ Z 3: Compute r = x1 mod n . If r=0, then return to step 1. 4: Compute e = H(m) 5: Compute s = k−1(e + dr) (mod n). If s=0 then go to step 1. 6: return (r, s). Algorithm 2 ECDSA Signature Verification Input: Domain parameter D = (p, a, b, G, n, h), public key Q, message m, signature (r, s) Output: Acceptance of rejection of the signature 1: Verify 0 < r < n and 0 < s < n , if not you reject the signature 2: Compute e = H(m) 3: Compute w = s−1 mod n 4: Compute the two integers : u1 = we (mod n) and u2 = rw (mod n) 5: Compute the point X using the result of the computations : X = u1G + u2Q 6: If X = ∞ then you reject the signature 7: Convert the x co-ordinate of X, x1 to an integer v = x1 (mod n) 8: v = r, accept the signature 7.1 Proof of Correctness Proof. If the signature (r, s) from the message m was created by a honest signee of the message. We must then rearrange X to get X = u1G + u2Q, = u1G + u2dAG, = G(u1 + u2dA), 5 The cryptographic function used is the ’Secure Hash Algorithm’
  • 11. 8 CONCLUSION 11 utilising the definitions of u1 and u2 X = G(u1 + u2dA), = (s−1 e + s−1 rdA)G, = s−1 (e + rdA)G, = kG. kG equates to the same point from Algorithm 1, step 2. This is the same point as only the x co- ordinate was transmitted, with different equations, therefore v = r, demonstrating the signatures are equal, verifying the transaction, concluding how we arrive at the algorithm ECDSA. The decentralised and transparent system is further reinforced through the fact that any user on the blockchain can verify whether the signature is authentic as only the public key is required. 8 Conclusion In recent times, bitcoin and the block chain technology have been prevalent in the major financial institutions in which financial institutions are exploring the option to streamline systems, potentially slashing infrastructure costs [12]. This project was used to explore the mathematics behind these secure transactions, gaining an understanding of the fundamentals behind the algorithm. ECDSA is one of the adaptions of ECC, suggested as a substitute to other public cryptosystems such as RSA. This project is served as an introduction to ECDSA and has looked under the bonnet of the algorithm. With this said, hopefully the reader will have an enhanced knowledge of this. References [1] (March 30, 2015) [ONLINE] Avaliable from http://en.bitcoin.it/wiki/Secp256k1 [2] (March 16, 2016) [ONLINE] Avaliable from http://cs.ucsb.edu/ koc/ccs130h/notes/ecdsa-cert.pdf [3] Arto Salomaa Public-Key Cryptography Springer-Verlag, 3-540-61356-0, 1996 [4] Lawrence C. Washington Elliptic Curves: Number Theory and Cryptography Chapman & Hall, 1-58488-365-0, 2003 [5] Hans Delfs & Helmut Knebl Introduction to Cryptography: Principles and Applications Springer, 3-540-42278-1, 2002 [6] Darrel Hankerson, Alfred Menezes, Scott Vanstone Guide to Elliptic Curve Cryptography Springer-Verlag, 0-387-95273-X, 2004 [7] Pedro Franco Understanding Bitcoin- Cryptography, Engineering and Economics John Wiley & Sons, 978-1119019169, 20014 [8] Andreas M. Antonopoulos Mastering Bitcoin- Unlocking Digital Crypto-currency O’Reilly Media, 978-1-449-37404-4, 2010 [9] Christof Paarm Jan Petzel Understanding Cryptography- A textbooks for Student and Practitioners Springer, 978-3-642-44649- 8, 2010 [10] Neal Koblitz A Course in Number Theory and Cryptography Springer-Verlag, 0-387-94293-9, 1948 [11] Hodson, Hal "Bitcoin moves beyond money". New Scientist, 2013, Vol.220(2945): pp.24-24. Print. [12] Jane Wild, Martin Arnold and Philip Stafford (November 1, 2015) [ONLINE] Avaliable at http://www.ft.com/cms/s/2/eb1f8256-7b4b-11e5-a1fe-567b37f80b64.html#axzz42EcFPVJX [13] CryptoBond, (2016), Elliptic Curve over finite field [ONLINE]. Available at: https://www.cryptocompare.com/wallets/guides/what-is-elliptic-curve-cryptography/ [Accessed 22 March 16]. [14] Andrea Corbellini, (2015), Elliptic Curve Cryptography: a gentle introduction [ONLINE]. Available at: http://andrea.corbellini.name/2015/05/17/elliptic-curve-cryptography-a-gentle-introduction/ [Accessed 22 March 16]. [15] Christopher Parker, (2016), SYMMETRY AND GROUPS. Available at: University of Birmingham, Edgbaston, Birmingham B15 2TT [Accessed 19 March 16]. [16] Hero Modares, Yasser Salem, Rosli Salleh and Majid T. Shahgoli "A Bit-Serial Multiplier Architecture for Finite Fields Over Galois Fields". J. Comput. Sci, 2010, Vol.220(2945): 6: 1237-1246.