Download Cryptanalysis Techniques: Kasiski Examination and Common Modulus Attack and more Cheat Sheet Physics in PDF only on Docsity!
A
Report
on
LAB ATTACKS IMPLEMENTAION
carried out as part of the course CSE CS32 31
Submitted by
Sarthak Pundir (Registration No: 219310190) Prerit Jain (Registration No: 219301 505 )
in partial fulfillment for the award of the
degree of
BACHELOR OF TECHNOLOGY
In
Computer Science & Engineering
Department of Computer Science & Engineering, School of Computer Science and Engineering, Manipal University Jaipur, March 2024
Acknowledgement
This project would not have been completed without the help, support, comments, advice, cooperation, and coordination of various people. However, it is impossible to thank everyone individually; I am hereby making a humble effort to thank some of them. I acknowledge and express my deepest sense of gratitude to my internal supervisor Dr. Aditya Sinha for his/her constant support, guidance, and continuous engagement. I highly appreciate his technical comments, suggestions, and criticism during the progress of this project. I owe my profound gratitude to Dr. Neha Chaudhary, Head, Department of CSE, for her valuable guidance and for facilitating me during my work. I am also very grateful to all the faculty members and staff for their precious support and cooperation during the development of this project. Finally, I extend my heartfelt appreciation to my classmates for their help and encouragement.
ATTACK ON PRIVATE KEY: Kasiski Examination
Cryptanalysis of Vigenère Cipher: Leveraging Kasiski Examination
Introduction:
The Kasiski examination, named after Friedrich Kasiski, a 19th-century Prussian officer, stands as a seminal method in cryptanalysis, particularly renowned for its efficacy in breaking polyalphabetic ciphers such as the Vigenère cipher. Its fundamental principle lies in exploiting repetitive patterns within the ciphertext to unveil insights into the encryption key's length and composition. By meticulously scrutinizing the occurrences of recurring sequences, this technique unveils the underlying structure of the cipher, enabling cryptanalysts to deduce the key's length and subsequently unravel the encrypted message. Kasiski examination, though rooted in classical cryptanalysis, continues to serve as a foundational tool for understanding and breaking cryptographic systems, illustrating the enduring relevance of historical methodologies in modern security contexts.
Working:
Here's how Kasiski examination works: 1.Identifying Repeating Patterns 2.Calculating Distances 3.Finding Factors 4.Determining Key Length 5.Breaking the Cipher 6.Frequency Analysis 7.Decrypting the Message
Prevention:
To prevent the Kasiski examination attack and enhance the security of cryptographic systems, several strategies can be employed:
- Increase Key Length: Using longer keys can significantly increase the complexity of the cipher and make it more resistant to attacks. Longer keys make it harder for attackers to identify repeating patterns and deduce the key length using techniques like Kasiski examination.
- Use Modern Encryption Algorithms: Modern encryption algorithms, such as Advanced Encryption Standard (AES), are designed to resist classical cryptanalysis techniques like Kasiski examination. AES, for example, uses a substitution-permutation network and operates on fixed-length
blocks of data, making it highly resistant to frequency analysis and other classical attacks.
- Randomize Key Generation: Instead of using easily guessable keys or keys based on easily identifiable patterns, keys should be generated using strong randomization techniques. This prevents attackers from exploiting patterns in the key to deduce its structure.
- Avoid Repeating Keys: Using a key that does not repeat within the ciphertext can prevent attackers from identifying repeating patterns that could aid in determining the key length. One-time pads, for example, use a key that is at least as long as the message and never repeats, making them theoretically unbreakable if used correctly.
- Employ Authentication and Integrity Checks: Implementing cryptographic protocols that include authentication and integrity checks can ensure that the ciphertext has not been tampered with during transmission. Even if an attacker manages to deduce the key length, ensuring the integrity of the ciphertext can prevent them from successfully decrypting it.
- Regularly Update Encryption Protocols: As cryptanalytic techniques evolve, it's important to stay updated with the latest cryptographic protocols and algorithms. Regularly updating encryption protocols ensures that systems remain resilient against emerging attacks, including those based on historical cryptanalysis techniques like Kasiski examination. By implementing these strategies, organizations can mitigate the risk of attacks like Kasiski examination and bolster the security of their cryptographic systems against both classical and modern cryptanalysis techniques.
Implementation:
A Python implementation of Kasiski examination and Vigenère cipher decryption showcases the practical application of this venerable technique. The interactive code solicits user input for the ciphertext and assumed keyword length. Subsequently, Kasiski examination is executed to unveil potential keyword lengths. Employing frequency analysis within ciphertext segments, the code proceeds to decrypt the message under the assumed keyword length.
Conclusion
Kasiski examination stands as a testament to the enduring efficacy of classical cryptanalysis techniques against historical ciphers such as the Vigenère cipher. While modern cryptographic algorithms pose greater challenges, understanding
ATTACK ON PUBLIC KEY: Common Modulus Attack
INTRODUCTION:
- The Common Modulus Attack is an attack on the RSA cryptosystem, which is named after its creators Rivest–Shamir–Adleman. This attack can be performed when two different ciphertexts of the same message are encrypted with different exponents but share a common modulus.
- This attack is extremely rare to happen in real-world scenarios, but it is very useful to understand it if you are interested in cryptography. It’s also worth noting that there are Python scripts available to perform common modulus attacks on RSA.
A REAL-LIFE EXAMPLE:
- Let’s consider a scenario where Alice, Bob, and Chris are communicating over a public network. They encrypt all messages they send using the RSA system.
- Bob and Chris have the RSA modulus nB and nC respectively with nB = nC but different public encryption exponents: eB ≠ eC. Suppose gcd(eB,eC) = 1, and that Alice sends the same secret message to Bob and Chris.
- Now, Eve is eavesdropping on the messages. She has access to two different ciphertexts of the same message M that have been encrypted with different exponents but a common modulus:
- ct₁ = E₍ₙ, ₑB₎(M)
- ct₂ = E₍ₙ, ₑC₎(M)
- She can recover the plaintext if gcd(eB, eC) = 1 and gcd(ct₂, n)=11.
- The math behind the attack is as follows1:
- If gcd (eB, eC)=1, then there exist integers s1 and s2 such that eBs1 + eCs2 = 1.
- By using the Extended Euclidean algorithm, we can find s1 and s2 and then it is easy to show that the plaintext can be recovered as follows (all math performed in the common modulo): M = (ct₁^s1 * ct₂^s2) mod n1.
- Although the equation seems straightforward, it is a little bit more
complicated to evaluate it as normally s2 will be a negative integer.
HOW TO PROTECT AGAINST CMA’S:
To protect against Common Modulus Attacks, you can consider the following measures:
- Use large prime numbers for the modulus (n): This makes factorization more difficult, thereby increasing the security of the RSA system.
- Avoid using coprime encryption exponents (e1 and e2): The Common Modulus Attack can only be performed if the greatest common divisor (gcd) of the two exponents is 11. Therefore, by avoiding the use of coprime exponents, you can prevent this attack.
- Implement proper key management practices: This includes preventing the sharing of the same modulus between different public keys. Each pair of RSA keys should have a unique modulus.
- Regularly update and patch RSA implementation: This helps to address any security vulnerabilities that could be exploited by attackers.
- Ensure that the set of encryption exponents has a number larger than 1 as a common factor.
CODE IMPLEMENTATION:
- Algorithm Runs Indefinitely for Prime Numbers: The algorithm will run indefinitely if the number to be factored is prime1. This is because the algorithm is designed to find nontrivial factors of a composite number, and a prime number has no nontrivial factors1.
- Dependent on Initial Values: The efficiency of the algorithm can be highly dependent on the initial values of x, y, and c1. If the initial values are not well-chosen, the algorithm may fail to find the factors and return a failure for composite n1. In that case, we use a different set of x, y and c and try again1.
- Limited by Size of Smallest Prime Factor: The running time of Pollard’s rho algorithm is proportional to the square root of the size of the smallest prime factor2. Therefore, if the smallest prime factor is large, the algorithm can be slow2.
- Requires Closed-Form Formula for Quantum Parallelism: For a quantum version of Pollard’s rho algorithm, the set of functions for generating the sequence of numbers must have a closed-form formula so we can take advantage of quantum parallelism3. The closed-form formulas we have so far found are dependent on the order of an element in the multiplicative group of integers modulo a composite, whose fast computation can currently only be done by Shor’s algorithm.
CODE