Git Product home page Git Product logo

network-security-course-project's Introduction

Network Security Project - Attack textbook RSA

Requirement

  • pycrypto 2.6.1

you can install this libray by

pip install pycrypto

Part 1

Goal: Implement the textbook RSA algorithm (without any padding)

The code for this part is mainly in rsa.py and it is able to:

  • Generate a random RSA key pair with a given key size (e.g., 1024bit) ✅
  • Encrypt a plaintext with the public key ✅
  • Decrypt a ciphertext with the private key ✅

Part 2

Goal: Perform a CCA2 attack on textbook RSA. The attak is to gradually reveal information about an encrypted message, or about the decryption key iteself.

In this attack, the server knows RSA key pair and AES key. The adversary knows RSA public key, RSA-encrypted AES key and an AES-encrypted WUP request. More detail can be found on this paper.

The code for this part is mainly in client_server.py and attacker.py. They are able to:

  • Simulate the server-client communication. ✅
  • Generate history message and they are guaranteed to include RSA-encrypted AES key and an AES-encrypted request. ✅
  • Present the attack process to obtain the AES key and further decrypt the encrypted request. ✅

Part 3

Goal: defend the attack by implementing a RSA-OAEP algorithm.

The code for this part is mainly in utils.py. It is able to add the OAEP padding module to the textbook RSA implementation.

  • add the OAEP padding module to the textbook RSA implementation ✅
  • give a discussion on the advantages of RSA-OAEP compared to the textbook RSA ✅
  • As a bonus, you can futher try to present CCA2 attack to RSA-OAEP to see whether it can thwart the CCA2 attack you have implemented in part 2 ✅

Feel free to run:

python main.py

to see all of the required results.

network-security-course-project's People

Contributors

huanghongru avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.