CTG is a module in Semester 1.2 of the Cybersecurity and Digital Forensics (CSF) course in Ngee Ann Polytechnic (NP). This module covers the essential concepts of Cryptography, including Public Key Infrastructure (PKI), Digital Signature and Certificate, and the various encryption/decryption algorithms.
This GitHub repository contains the Python script written for the module's assignment, where teams are expected to implement a simulated working prototype that would depict the operations and workings of the cryptographic algorithms.
This cryptosystem aims to fufil the 5 goals of Cryptography, namely Confidentiality, Integrity, Availability, Authentication and Non-repudiation.
The five goals of cryptography are fundamental in ensuring secure communication and data management:
- Confidentiality: Ensuring that only authorized parties can access the information
- Integrity: Verifying that the information has not been altered during transmission
- Availability: Ensuring that authorized users have access to information when needed
- Authentication: Verifying the identity of the parties involved in communication
- Non-repudiation: Ensuring that a party cannot deny the authenticity of their signature on a document
This cryptosystem includes the implementation of:
- Symmetric Cryptosystem: Kuznyechik ("Grasshopper") - Symmetric Block Cipher
- Asymmetric Cryptosystem: ElGamal Encryption System
- Cryptographic Hash Function: BLAKE2b
The integration of these 3 cryptographic components into a single, integrated cryptosystem ensures that all the goals of cryptography (Confidentiality,
Integrity, Availability, Authentication, Non-repudiation) can be achieved effectively.
- The sender wants to send a secure message to the recipient.
- The message is in plaintext format and needs to be encrypted to maintain confidentiality.
- To ensure
integrityandnon-repudiation, the sender generates a hash of the plaintext message.- The sender uses BLAKE2b, a cryptographic hash function, to create a unique, fixed-length hash of the plaintext data.
- This hash acts as a digital fingerprint of the message.
- The hash is then appended to the original plaintext message before encryption.
- The sender uses the Kuznyechik ("Grasshopper") cipher to encrypt the message along with its hash.
- This is a symmetric encryption algorithm, where the same key is used for both encryption and decryption.
- The combined plaintext message and hash are converted into ciphertext using the symmetric Kuznyechik key.
- The
confidentialityof the message is ensured as only the authorized parties (who have access to the key) can decrypt it.
- The sender then uses the ElGamal encryption system to encrypt the original hash separately.
- This uses asymmetric encryption, where a pair of keys (public and private) is used.
- The sender encrypts the original hash using the recipient’s public key.
- This ensures
authenticationandnon-repudiation, as only the recipient can decrypt the hash using their private key, verifying the integrity and authenticity of the sender's message.
- The sender sends the following to the recipient:
- Encrypted message (ciphertext) with the appended plaintext hash (encrypted using ElGamal).
- Sender’s public key: Used by the recipient to verify the authenticity of the sender and the message.
- The recipient uses their private key to decrypt the message that was encrypted using Kuznyechik.
- This will give them the original plaintext message along with the appended hash.
Confidentialityis maintained as only the intended recipient, who has the correct private key, can decrypt the message.
- The recipient then decrypts the encrypted hash (which was appended to the message) using their private key (ElGamal decryption).
- This process will give them the original hash value that was generated by the sender.
- The recipient re-generates the hash of the decrypted plaintext message using
BLAKE2b.- If the newly generated hash matches the decrypted hash from Step 7, it proves that the message has not been altered and is intact.
- If the hashes match, the
integrityandnon-repudiationof the message are verified.
- The recipient can now be confident that:
- The message has not been tampered with (ensuring
integrity). - The message was indeed sent by the rightful sender (ensuring
authentication). - The sender cannot deny sending the message (ensuring
non-repudiation).
- The message has not been tampered with (ensuring
This step-by-step integration ensures that all cryptographic goals are achieved effectively: Confidentiality, Integrity, Availability, Authentication, and Non-repudiation.
- Clone the Git repository:
git clone https://github.com/Tan-JunWei/NP_1.2_CTG-ASG.git- Navigate to folder:
cd NP_1.2_CTG-ASG- Install dependencies:
pip install -r requirements.txt- Run the integrated script (WIP):
python integrate_with_hash.py

