Design of A Synchronous Stream Cipher From Hash Functions
Design of A Synchronous Stream Cipher From Hash Functions
8, August 2007
69
Key words:
stream cipher, key, keystream, one-time pad cryptosystem, hash function, keyed hash function.
Small Encryption: banks and commercial companies need secure encryption methodologies to interact with customers by small encryption technologies. Definitely, a good algorithm should be suitable for lots of disparate situations. The paradigm is to approach, as much as possible, to the ideal features constituting the one-time pad cryptosystem. The one-time pad cipher is unconditionally secure as Shannon proved in his seminal paper[9]. According to the one-time pad cipher design, the length of the key must be at least as long as the plaintext and it must be completely random. The one-time pad can offer the maximum security degree but it is hard and really expensive to be realized, in fact the secure distribution of the required keying material would pose an enormous logistical problem if the one-time pad were used on a large scale. Similarly to all the existing stream ciphers, our algorithm presents two main periods: 1. During the first period the key and the keystream are generated using a hash function with scientific criteria. 2. The second period will apply to final computational step, producing the ciphertext. Definitions: Plaintext message m is a sequence of bits Ciphertext message c is a sequence of Keystream is a pseudo-random
m0 m1 K mn 1 ;
of bits
c0 c1 K c n 1 ;
sequence
k 0 k1 K k n 1 ;
c i = mi k i for 0 i n 1 where denotes bitwise exclusive-or.
2. Design of the Stream Cipher
In this chapter the design of the algorithm will be described in its theoretical essence, hinting sometimes at his probable practical implementation.
70
IJCSNS International Journal of Computer Science and Network Security, VOL.7 No.8, August 2007
2.1 Generation of the Key During this phase the key is generated applying HMAC[11] to the input password.
2.1.1 The Function HMAC HMAC is an adaptation of NMAC[11] that uses directly the iterated hash function (with its defined and fixed IV) as the basic black-box to build the MAC. Denoted with F the (iterated and keyless) hash function initialized with its own IV value, with x any input of arbitrary length and with k the key:
HMAC k ( x ) = F ( k || pad1 || F ( k || pad 2 || k )) = HMAC k ( k ) where pad 1 and pad 2 are distinct strings of sufficient length to pad k out to a full block for the compression function of the hash function. 2.1.2 Key of the Stream Cipher The key is the result of the function HMAC to the input password k:
l/2
key = F ( k || pad1 || F ( k || pad 2 || k ) = HMAC k ( k ) wher e F is the hash function with properties required in 4.2.
compromise the performance without any security advantage) possibly not restricting only to m1 , to achieve a better security and to let the range of the hash function, theoretically (excluding collisions), equal the co-domain (i.e.
context. For example, in order to minimize the collision effects of the hash function (if it is weakly collision resistant, even if it should not be), one should take some bits from different positions of the past keystream, in fact, under certain conditions, a collision could compromise the security of the stream cipher.
Once that n is fixed it must be the same for all the generation of the keystream while m can assume different values for a mono-dimensional matrix M = ( m1 , m 2 , K , mi ) so that q ( xi ) = LSBm ( xi ), i 1 . i
IJCSNS International Journal of Computer Science and Network Security, VOL.7 No.8, August 2007
71
Moreover, even if part of the input is known, it should be difficult to find the remainder (e.g., if t input bits remain unknown, it should take on average 2 hash operations to find these bits). Collision resistance. It should be computationally infeasible to find two inputs x,y with x y such that
t 1
of the hash function and M is the banal matrix, it can happen that a very short cycle of bits build the keystream, as shown below:
f ( x) = f ( y ).
Mixing-Transformation. On any input x, the output hashed value h = f (x ) should be computationally indistinguishable from a uniform binary string. Here, the computational indistinguishability follows Definition 4.15 (in 4.7) in [8]. Theorem 1: Let f be the underlying iterated hash function of the proposed stream cipher. The following properties of f are necessary condition for the security of the stream cipher: preimage resistance, partial-preimage resistance, collision resistance and mixing-transformation.
The theorem states that all above properties of the hash function are necessary for the security of the stream cipher, thus, if one of them should not be respected the security would be compromised (at least theoretically).
y (2) = y (1)
y (3) = f ( p ( y (2)) || q( y (1)) || key) = f ( p ( y (1)) || key) = y (2) = y (1) M y (1) = y (2) = y (3) = K = y (n)
4.
Proof of Theorem 1: 1. Preimage resistance. Let f be the underlying hash function of the secure stream cipher and h the hashed value. Suppose, for absurd, that f is not preimage resistant, therefore, it is feasible to find the input x such that h = f(x). In a knownplaintext attack the adversary can recover the key, that is in the keystream preimage with probability 1 and minimum computational power, contradicting the above mentioned security of the stream cipher. 2. Partial-preimage resistance. Let f be the underlying hash function of the secure stream cipher and h the hashed value. Suppose, for absurd, that f is not partial-preimage resistant, therefore, it is feasible to find the whole input x, such that h = f(x), if x is partially known. In a known-plaintext attack the adversary, that knows part of the input x (except the key) used to generate the keystream, can smoothly recover the remaining input containing the key, contradicting the above mentioned security of the stream cipher. 3. Collision resistance. Let f be the underlying hash function of the secure stream cipher. Suppose, for absurd, that f is not collision resistant, therefore, it is recurrent to find two inputs x,y with x y such that f ( x) = f ( y ). During the generation of the keystream of the stream cipher's, if n has the same value of the length of the output
In a known-plaintext attack, the adversary can reproduce the whole keystream, that is the same cyclical set of few bits, recovering the plaintext, contradicting the stream cipher's above mentioned security. Mixing-Transformation. Let f be the underlying hash function of the secure stream cipher. Suppose, for absurd, that f does not realize a mixing-transformation, therefore, the output hashed value h = f(x) is polinomially distinguishable from a truly random binary string. The attacker may be able to predict the input/output with non-negligible advantage > 0 , recovering the keystream, contradicting the above mentioned security of the stream cipher.
At last, hash functions with less than 160 bits of output should not be considered.
72
IJCSNS International Journal of Computer Science and Network Security, VOL.7 No.8, August 2007
Attacks that works on HMAC and not on NMAC are possible, in principle. However, such an attack would reveal significant weaknesses of the pseudorandom properties of the underlying hash function, contradicting in a strong sense the usual assumptions on these functions.
k1
+ 2 k2 instead of
trials. 2 MDx-MAC/NMAC/HMAC. These methods are dedicated constructions to build a secure MAC from an unkeyed hash function and to avoid all the known attacks. In the proposed stream cipher, the generation of the keystream is done by keying the iterated hash function with the secret suffix method, because it is evidently more efficient than the dedicated MAC constructions(i.e. MDxMAC, NMAC, HMAC) but, in this context secure, too. The secret suffix method is shown to be weak to the forgery if a second preimage attack on the hash function is feasible[10], but the hash function for the proposed cipher has to be collision resistant which implies the second preimage resistance property. In a known-plaintext attack scenario, where k / n textMAC pairs are known, the adversary should compute
6. Conclusions
An important aspect of this work is to consider the hash function as a black-box. In fact, the hash function can be seen as a module that can be replaced in case serious weaknesses are found in the hash function or when new more secure or efficient hash function are designed. We conjecture that the most efficient way to break the proposed stream cipher is to break the underlying hash function or through exhaustive search for the keyspace K of k bits, that requires O ( 2 ) operations. In fact, it is true that the pseudo-randomness of the keystream is unconditionally secure only under the random oracle model but a ROM-based security proof suggests that for a real world encryption scheme which uses real world hash functions rather than ROs, the most vulnerable point to mount an attack is the hash function used in the scheme[8]. Since breaking suitable real world iterated hash functions such as RIPEMD-160[2] or SHA1[1] is considered a hard problem, breaking the stream cipher shold be, too. The complexity of the algorithm is embedded in the oneway hash function.
k
O(2 ) off-line operations. Besides, given one known text-MAC pair, it is possible to performe an existential MAC forgery if a second preimage attack on the hash function is feasible. If t textMAC pairs are known, finding a MAC second
preimage requires 2 trials; if the length of the message is not appended t denotes the number of blocks rather than the number of messages[10]. In order to recover the key are needed
n/t
n/2
O (2 ) operations and known MAC-text pairs for the verification. The Envelope Method. This method combines the prefix and the suffix methods. It consist of prepending a secret key k1 and appending a
secret key k 2 to the message x before the hashing operation: MAC ( x) = h( k1 || x || k 2 ) . As shown in [10], this method is also subject to the forgery and it is possible to apply a divide and conquer key recovery attack on k1 and k 2 so that with 2
n/2
IJCSNS International Journal of Computer Science and Network Security, VOL.7 No.8, August 2007
73
References
[1] Secure Hash Standard. http://www.itl.nist.gov/fipspubs/fip180-1.htm, 1995 April 17 [2] Hans Dobbertin, Antoon Bosselaers, and Bart Preneel. RIPEMD-160. http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html [3] M.J.B. Robshaw. Stream Ciphers. RSA Laboratories Technical Report TR-701 Version 2.0 July 25, 1995 [4] RSA Laboratories. Answers to Frequently Asked Questions About Today's Cryptography Revision 2.0, RSA Data Security Inc., 5 Oct 1993. [5] E. MendelsonThe language of first order logic. Cambridge University Press, 1993. [6] Codes and Cryptography. Dominic Welsh. Codes and Cryptography. Oxford University Press, 1988. [7] Thomas H. Cormen, Charles E: Leiserson, and Ronald L. Rivest. Introduction to Algorithms. The MIT Press, Cambridge, MA, 1990. [8] Wenbo Mao. Modern Cryptography Theory and Practice. Prentice Hall PTR, 2004. [9] C.E. Shannon. Communication theory of secrecy systems. Bell System Technical Journal, 28:657-715, 1949. [10] Bart Preneel, Paul C. van Oorscot. MDx-MAC and Building Fast MACs from Hash Functions. Springer-Verlag LNCS, August 1995. [11] M. Bellare, R. Canetti, and H. Krawczyk. Keying Hash Functions for Message Authentication. Advances in Cryptology - Crypto 96 Proceedings, Lecture Notes in Computer Science Vol. 1109, N. Koblitz ed, SpringerVerlag, 1996. [12] Stephen Bernstein, Ruth Bernstein, Schaums. Schaum's Outline of Elements of Statistics I: Descriptive Statistics and Probability. McGraw-Hill, 1998. [13] Barbara Liskov, John V. Guttag. Abstraction and Specification in Program Development. McGraw Hill Text, December 1986. [14] Paolo Baldi. Introduzione alla Probabilit con elementi di Statistica. McGraw-Hill, 2003. [15] Clifford A. Shaffer. A Practical Introduction to Data Structures and Algorithm Analysis. Prentice Hall, 1998. [16] B. Schneier. Applied Cryptography. John Wiley \& Sons, New York, 1994 [17] Frederick P.Brooks. The Mythical Man-Month: Essays on Software Engineering. Addison-Wesley, Reading, MA, 1975. [18] A. Menezes, P. van Oorschot, and S. Vanstone. Handbook of Applied Cryptography. CRC Press, 1996. [19] R.J. Enbody and H.C. Du. Dynamic Hashing schemes. Computing surveys, 1988. [20] G.Tsudik. Message authentication with one-way hash functions. ACM Computer Communications Review, Vol. 22, No. 5, 1992, pp. 29-38. [21] P. Gutmann, personal communication, 1993.
Angelo P. E. Rosiello received the B.S. and M.S. degrees in Computer Science Engineering cum laude from Politecnico di Milano in 2004 and 2006, respectively. At the moment, Angelo works for Accenture in the Security Service Line. He also collaborates with Prof. Christopher Kruegel and Prof. Engin Kirda (Technical University of Vienna) in the ICT security field.