Giter Site home page Giter Site logo

ca-secure-transport's Introduction

Process of starting program

  1. Install Openssl and Pycrypto libraries
pip3 install pyopenssl
pip3 install pycryptodome
  1. Run CUHK.py and Blackboard.py
  2. Run Student.py, enter student ID
  3. Wait for the program to finish running

Server and Client

  • CUHK (Port: 9335)
  • Blackboard (Port: 3141)
  • Student

Program running process

img_3.png img_2.png

Step 0

  1. After CUHK.py and Blackboard.py are started, these two processes keep listening on ports 9335 and 3141 respectively.
  2. At the same time, CUHK.py will generate key pairs and root certificates, store the root certificate and key in the local cuhk.cer and cuhk.key locations respectively.

Step 1

  1. Running Student.py, then enter 10 digits as student ID.
  2. Then, it will generate a key pair, and use it to generate a CSR request.
  3. Serialize the CSR request and send it to CUHK.py ( port: 9335 )

Step 2

  1. CUHK.py get CSR request from Student.py.
  2. Sign CSR request and use CSR Request,cuhk.cer and cuhk.key to generate cert 2.
  3. Send back cert 2 to Student.py by socket.
  4. Student.py get cert 2 from CUHK.py ( port: 9335 ), then dispaly "SID: ********** sign finished." in terminal.

Step 3

  1. Student.py initiate a request by concatenating, Request: "SID:********** requests to upload report !" | Cert 2
  2. Blackboard.py get the request, and then take out Cert 2 from it.
  3. Blackboard.py read root certificate from local filecuhk.cer.
  4. Blackboard.py verify the validity of the Cert 2, if the verification is passed, go to the next step, or the program will terminate.

Step 4

  1. Blackboard.py generate a session key.
  2. Blackboard.py get the public key from Cert 2.
  3. Use public key to encrypt session key, and then send it to Student.py.

Step 5

  1. Student.py get encrypted session key, then use its private key that are used to generate the CSR request to decrypt the session key.
  2. Then, Student.py send the decrypted session key to Blackboard.py.
  3. Blackboard.py verify the decrypted session key.
  4. If check pass, Student.py and Blackboard.py start to communicate.

Step 6

  1. Student.py use session key and message content to generate HMAC, then concatenate message and HMAC: Message Content | HMAC, send it to Blackboard.py.
  2. Blackboard.py get concatenated message and HMAC, then take message out, recalculate HMAC using session key.
  3. Compare the HMAC from Student.py with the recalculated HMAC, if they are the same, the message is valid, output message in terminal.

Related Picture

Socket

img_1.png

CA

img.png

Reference

ca-secure-transport's People

Contributors

da1ooo avatar

Stargazers

 avatar

Watchers

 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.