Merkle Signature Schemes, Merkle Trees and Their Cryptanalysis
Total Page:16
File Type:pdf, Size:1020Kb
Merkle Signature Schemes, Merkle Trees and Their Cryptanalysis Georg Becker 18.07.08 Seminararbeit Ruhr-Universit¨at Bochum Chair for Embedded Security Prof. Dr.-Ing. Christof Paar Contents 1 Introduction 1 2 One-Time Signatures 2 2.1 Securehashfunctions......................... 2 2.2 LamportOne-TimeSignatureScheme. 3 2.2.1 Keygeneration ........................ 3 2.2.2 Signingamessage....................... 3 2.2.3 Signatureverification . 3 2.3 WinternitzOne-timeSignatureScheme . 4 2.3.1 Keygeneration ........................ 4 2.3.2 Signaturegeneration . 5 2.3.3 Signatureverification . 6 2.3.4 Choosingparameterw . 6 3 Merkle-Signature Scheme 8 3.1 Keygeneration ............................ 8 3.2 Signaturegeneration ......................... 9 3.3 Signatureverification . 9 3.4 Costanalysis ............................. 10 4 The Merkle tree traversal problem 12 4.1 Thetreehashalgorithm. 12 4.2 Theclassictraversal ......................... 13 4.3 Merkle tree traversal in log space and time . 16 4.4 Fractal tree representation and traversal . 18 5 Improvements to Merkle-Signature Scheme 20 6 Cryptanalysis 22 ′ 6.1 Case 1: H(Yi )= H(Yi)........................ 22 6.2 Case 2: H(Y ′) = H(Y )........................ 22 i 6 i 6.3 Differential Side Channel resistant . 23 7 Conclusion 24 1 Introduction In todays world, digital signatures are an indispensable element for secured com- munication applications. They are needed, to ensure the authentication of a communication partner, i.e. in web services like Email or chats. They are also needed, to ensure the authentication of a web server for web services like web- shops or online-banking. But digital signatures are not just used in web services. For example, they can also be used to verify the validity of digital passports or other digital documents. Popular signature schemes are the Digital Signature Scheme (DSA) and the RSA Signature Scheme. The security of these schemes rely on the difficulties of solving the discrete logarithm problem and the problem of factorizing large numbers. Today, no efficient algorithms are known to solve these problems, so that theses schemes are considered secure. However, it is not proven that no such algorithms exist. If the mathematicians are able to find a suitable algorithm, these signature schemes would become insecure. Furthermore, there are already algorithms known to solve these problems in case a quantum computer can be build. Some scientists believe it might be possible to build a quantum computer in about 20 years. Therefore, alternative digital signature schemes are needed, in case the signature schemes based on the discrete logarithm problem or the factorization problem become insecure. The Merkle Signature Scheme provides such an alternative signature scheme. As we will see in chapter 6, the security of the Merkle Signature Scheme only depends on a secure hash function and a secure one-time signature. The charac- teristics of secure hash functions are described in section 2.1 and two examples of secure one-time signature schemes are given in section 2.2 and 2.3. In chapter 3 the Merkle Signature Scheme will be introduced. In chapter 4, methods for solving the Merkle Tree Traversal Problem are described. Efficient methods to solve this problem are needed to make the signature scheme feasible. In chapter 5 further improvements to the original Merkle Signature Scheme are introduced, which make the signature scheme more efficient. 2 One-Time Signatures 2.1 Secure hash functions The security of One-Time Signatures is based on cryptographic secure hash func- tions. In this section we will define the properties of a cryptographic secure hash function. A hash function H : 0, 1 ∗ 0, 1 s is cryptographic secure, if it is ”preimage resistant”, ”second preimage{ } → resistant” { } and ”collision resistant”. Preimage resistant: • A hash function H is preimage resistant, if it is hard to find any m for a given h with h = H(m). Second preimage resistance: • A hash function H is second preimage resistant if it is hard to find for a given m1 any m2 with H(m1)= H(m2). Collision resistant: • A hash function H is collision resistant if it is hard to find a pair of m1 and m2 with H(m1)= H(m2). For a good cryptographic secure hash function no algorithm should be known, which solves the preimage resistance and second preimage resistance problem more efficient, than a brute force attack. In a brute force attack against preimage resistance, the attacker chooses m randomly until h = H(m). H(m) can have s 2 different results. Each result h should appear with the same probability Ph s s with Ph = 1/(2 ). Therefore, an attacker would have to choose on average 2 /2 different inputs m, until he finds an m with h = H(m). With the same idea, we s find out that the attacker would need on average 2 /2) different inputs m2, until he finds an m2 with H(m1) = H(m2). So the complexity of an attack against preimage and second preimage resistance is 1/2 2s = O(2s), with s being the length of the result of the hash function in bits. ∗ Unfortunately, breaking collision resistance by finding a pair of m1 and m2 with H(m1)= H(m2) is easier than breaking preimage resistance. This is due to the birthday problem (also referred to as birthday paradox). Birthday problem: [AMV96] An urn has m balls numbered 1 to m. Suppose that one ball at a time is drawn from the urn with replacement. On average about πm balls must be drawn until one ball is drawn twice. p 2 2.2 Lamport One-Time Signature Scheme 3 So referred to the complexity to find a pair m1, m2 with H(m1) = H(m2) s this means that in average π2 O(√2s) hash operations must be performed. q 2 ≈ To achieve a collision resistance with a security of at least O(280) the size of the hash function H : 0, 1 ∗ 0, 1 s must be at least 160 bits because O(√2160)= O(280). { } → { } 2.2 Lamport One-Time Signature Scheme The Lamport One-Time Signature Scheme (LOTSS) is a signature scheme in which the public key can only be used to sign a single message. The security of the LOTSS is based on cryptographic hash functions. Any secure hash function can be used, which makes this signature scheme very adjustable. If a hash function becomes insecure it can easily be exchanged by another secure hash function. In the following first the key generation, then the signing algorithm and finally the verification algorithm are described. 2.2.1 Key generation Let H : 0, 1 ∗ > H : 0, 1 s be a cryptographic hash function. To sign a { } − k { } message M = (0, 1) choose 2 k random numbers Xij with 1 i k and j = 0, 1 . For each i and j compute∗ Y = H(X ). These 2 k ≤values≤ Y are { } ij ij ∗ ij the public key, while the Xij values are the private key. 2.2.2 Signing a message Given is a message M = m1,m2, ..., mk with mi 0, 1 and the private keys Xij with 1 i k and j = 0, 1 . For each i it is∈ checked { } whether m equals 0 or ≤ ≤ { } i 1. If it equals 0 then sigi = Xi0 otherwise sigi = Xi1. The signature sig is the concatenation of all sigi for i = 1, ..., k . So sig = (sig1 sig2 ... sigk) with denotes the concatenation of two{ values.} || || || || 2.2.3 Signature verification Let sig =(sig sig ... sig ) be the signature of a given message M = m ,m , ..., m 1|| 2|| || k 1 2 k with mi 0, 1 and Yij the corresponding public key of the Lamport One- Time Signature∈ { Scheme.} For each 1 i k the hash value H(sig ) gets com- ≤ ≤ i puted. If mi = 0 then H(sigi) must be H(sigi)= Yi0 otherwise H(sigi) must be H(sigi)= Yi1 to be a valid signature. 4 One-Time Signatures 2.3 Winternitz One-time Signature Scheme One major disadvantage of the Lamport One-Time Signature Scheme is the big size of the public and private key. To sign a message M = 0, 1 k, 2 k hash values have to be saved. To achieve a security of at least O(280{), a} hash∗ function must have at least 160 bits. Therefore, the private and the public key must have at least 160 2 k = 320 k bits. In most cases a message will be hashed before it is signed,∗ so that∗ the size∗ k of the message M will also be 160 bits long. This results in a total size of the public and private key of 160 2 160 bits = 51200 bits = 6400 bytes. Hence, a public key of the Lamport One-Time∗ ∗ Signature Scheme is 50 times larger than an equivalent 1024-bit RSA public key. The signature sig is the concatenation of k hash values. For k = 160, the signature size is 160 k ∗ bits = 25600 bits = 3200 bytes. Hence a LOTSS signature is about 25 times bigger than an equivalent 1024-bit RSA signature. In the Winternitz One-time Signature Scheme the signature size can be reduced at the cost of hash operations. Figure 2.1: Building the values bi and the checksum C 2.3.1 Key generation Let H : 0, 1 ∗ H : 0, 1 s be a cryptographic hash function. At first the pa- { } → { } rameter w, with w N, is chosen and and t = s/w + ( log2 s/w +1+ w)/w gets calculated. A∈ larger parameter w reduces⌈ the⌉ signature⌈ ⌊ ⌈ size⌉⌋ but increases⌉ the calculation time. We now choose t random numbers X , ..., X 0, 1 s. 1 t ∈ { } These random numbers are the private key X = (X1 ... Xt). In the next step 2w||−1 || the public key Y is generated by computing Yi = H (Xi) for i = 1, ..., t.