CCAM an Intelligence Brute Force Attack on RSA Cryptosystem
Total Page:16
File Type:pdf, Size:1020Kb
Communications in Computational and Applied Mathematics, Vol. 1 No. 1 (2019) p. 1-7 CCAM Communications in Computational and Applied Mathematics Journal homepage : www.fazpublishing.com/ccam e-ISSN : 2682-7468 An Intelligence Brute Force Attack on RSA Cryptosystem Chu Jiann Mok1, Chai Wen Chuah1,* 1Information Security Interest Group (ISIG), Faculty of Computer Science and Information Technology, Universiti Tun Hussein Onn Malaysia 86400 Parit Raja, Batu Pahat, MALAYSIA *Corresponding Author Received 27 November 2018; Abstract: RSA cryptosystem is the one of the public key cryptosystem used for secure data Accepted 01 March 2019; transmission. In this research, an intelligence brute force attack is proposed for attacking RSA Available online 07 March cryptosystem cryptanalysis. In the paper, the effectiveness in cryptanalysis is simulated. An 2019 experimental analysis of the proposed approach is carried out in order to evaluate its effectiveness in terms of time used for recovery RSA key. Performance of proposed algorithm compared with prime factorization and brute force attack on RSA toy box. The results are used to estimate the time required for real-life RSA cryptosystem in ideal conditions. Keywords: RSA cryptosystem, public key cryptosystem, brute force, cryptanalysis 1. Introduction Table 1 - Relationship between number of bits used in RSA was invented by Ron Rivest, Adi Shame and RSA cryptosystem and prime-to-nature numbers ratio Leonard Adleman in 1977. RSA is a public key cryptosystem Maximum nature No. Prime Prime-to- for securing data transmission. RSA encryption is asymmetric number numbers nature cipher, which consists of two keys: public key (,)ne and numbers ratio private key (,,)pqd . The value n is depending on product of p 16 6 37.50 and q. Hence, the p and q show a reciprocal relationship 32 11 34.38 between each other. At least one of p or q will less than n . In 64 18 28.13 this case, adversary can use prime factorization to obtain the 128 31 24.22 smaller value from p and q. During this process, adversary can 256 54 21.09 filter most composite numbers to increase cryptanalysis speed. 512 97 18.94 However, the ratio of prime numbers decreases slightly when 1024 172 16.80 number of bits increases to certain level. Table 1 shows the 2048 309 15.09 relationship between number of bits, and prime-to-nature 4096 564 13.77 numbers ratio. 8192 1028 12.55 In Table 1, the probability to getting a prime number is 16384 1900 11.60 decreased from 0.375 (4 bits) to 0.0590 (26 bits), which means 32678 3512 10.72 that getting a random prime number from a large nature number 65536 6542 9.98 pool becomes more difficult, but the difficulty to obtain a 131072 12251 9.35 random prime number becomes consistent when the total 262144 23000 8.77 natural number increased. 524288 43390 8.28 Brute force attack is a generic cryptanalysis that breaking 1048576 82085 7.82 cryptosystem by testing all of the possible key. This is typically 2097152 155611 7.42 time consuming. Therefore, this research proposed an 4194304 295947 7.06 intelligence brute force attack which may provide a faster way 8388608 564163 6.73 to perform cryptanalysis on RSA cryptosystem as compared to 16777216 1077871 6.42 traditional brute force attack. This research performs 33554432 2062993 6.15 simulation of cryptanalysis of RSA toy box. The RSA toy box 67108864 3956855 5.90 varies from 8-bit to 32-bit. Hence, predict time required for 100000000 5761455 5.76 larger sized RSA cryptosystem. To implement part of the 110000000 6308388 5.73 intelligence brute force attack algorithms, the main programming language used is C and C++. *Corresponding author: [email protected] 2019 FAZ Publishing. All right reserved. Mok, C. J. et al. Communications in Computational and Applied Mathematics, Vol. 1 No. 1 (2019) p. 1-7 2. Literature Review cryptosystem cracked [5]. Padding scheme is another possible Cryptography is the discipline of writing a message in restriction for implementation RSA cryptosystem widely. To enhance the security strength of RSA cryptosystem, the ciphertext, usually by a translation from plaintext according to 0.292 some frequency changing key text, with the aim of protecting a requirements of d is d > n [6]. For a typical 1024-bit RSA cryptosystem, the minimum value of d is d > n0.292, this is an secret from adversaries, interceptors, intruders, interlopers, 90 eavesdroppers, opponents, and enemies [1, 2]. The professional extremely large number (approximately 1.018 x 10 ). For a cryptography protects not only for the plaintext, but also for the message length of 1024-bit, the minimum number of the bit key, and more generally, tries to protect the whole required to perform modular exponentiation will be extremely cryptosystem. Before modern era, designation of cryptography large (≈306176 bits). The minimum number of bit required is is by taking advantages from literacy, such as Caesar cipher or calculated by Equation (4): "Yin" book. When the public literacy increases, the risk of (1024 299) ciphertext disclosure increases. In computer era, efficiency of log222 1024 299log 2 306176 (4) information spreading enhanced with the existence of internet. Thus, Kerckhoff’s principle was proposed in the 19th century. In order to enhance security strength of RSA encryption, In Kerckhoff’s principle, a secure cryptosystem should be, a padding scheme is deployed. Padding scheme must be one- everything about of the cryptosystem is public accessible, but to-one function to avoid disambiguation of message. If padding neither encryption key nor decryption key [3]. scheme algorithm is formularized, once the adversary obtains the padding scheme algorithm, a new padding scheme 2.1 RSA Cryptosystem algorithm must be generated to replace the old algorithm [7, 8]. RSA encryption is the first successful algorithm applied in If a padding scheme algorithm is substitution-based, it required 1024 public key encryption. This encryption algorithm is proposed a huge memory space to store all the 2 possible input values. and invented by Rivest et. al. in MIT, and published in 1978 Although substitution-based padding scheme algorithm will [4]. The RSA encryption process is as follows: increase difficulties for adversaries, however, it greatly reduces • Public key generation and private key generation efficiency for sender and receiver. Sender and receiver need to Public key and private key are important in public key of search the padding scheme before performing encryption, or after performing decryption. The searching difficulty is RSA cryptosystem. Public key is in the form of (,)ne whereas proportional to number of possible inputs. n is the semi factor product of two prime numbers used in RSA cryptosystem is a public key cryptosystem. The private key. e is the encrypt exponent, which must co-prime public key is available to both legitimate users and illegitimate with ()n . Private key is in the form of (,,)pqd , where p and users. If an adversary is able to encrypt every possible message q are prime numbers. d is the decryption exponent. The value, the adversary can obtain the plaintext from the ciphertext relationship between e and d is shown in Equation (1). intercepted by comparing the ciphertext. It makes the RSA vulnerable to chosen plaintext attack. Thus, in real life ed1( mod ( n )) d e1 (1) application, RSA cryptosystem is used to encrypt the keys of symmetric ciphers, such as AES. Due to the efficiency of Equation (1) shows that d is the modulo inverse of e, under symmetric ciphers, they are usually used to encrypt large size data [9]. In daily life, RSA cryptosystem is used to encrypt the mod . keys of symmetric ciphers such as AES, or generate digital • RSA encryption algorithm signatures, and the symmetric ciphers used to encrypt the large To encrypt the message via RSA, sender needs to turn the size data. message, M, into an integer value m, which 0 ≤ m ≤ n by using a padding scheme. Once M is converted into numeric m, the 2.3 Proof of Correctness ciphertext c will be generated by modular exponentiation as in Equation (2). In this section, Fermat’s Little theorem and Euler’s c me ( mod ( n )) (2) theorem are used to describe the RSA cryptosystem’s functionality. Fermat’s little theorem was used to prove the correctness of RSA cryptosystem’s functionality by Rivest et. Equation (2) shows that e is modulus equivalence with al. [10]. mod (n). • RSA decryption algorithm Theorem 1 (Fermat’s little theorem). If p is a prime number, Once the recipient received the ciphertext, the recipient then for any integer a, the number ap-a is an integer multiple of can decrypt the ciphertext again by modular exponential with p. In the notation of modular arithmetic, this is expressed as his/her private key, as shown in Equation (3). p a a(mod p ) . m ce ( mod ( n )) (3) Proof: From Equation (1), it can be concluded that: 2.2 Restriction in Implementation ed1(mod( p 1)( q 1)) (5) RSA cryptosystem uses modular exponentiation to reduce the probability of confidential message disclosed. However, Rewrite Equation (5), we obtain during the encryption and decryption process, general purposed computer is unable to process the high computational power ed1 k ( p 1)( q 1), k 0, k (6) required in key generation and modular exponential during the encryption. This makes RSA cryptosystem is infeasible in ed general purposed or larger message transmitting. Besides that, To check the congruency mod pq of m , and m is RSA cryptosystem is vulnerable to chosen plaintext attack. equivalent to check they are congruent mod p and mod q This increases the risk of the cryptosystem cracked. Padding separately.