This project implements encryption and decryption functions for both the Caesar and Vigenère ciphers as part of UWA's Secure Coding unit. It includes a command-line interface (CLI) to allow users to perform encryption and decryption tasks via terminal commands. The code incorporates secure coding practices such as input validation, memory safety, and error handling to ensure reliability and minimise security risks.
- Caesar Cipher: Encrypt and decrypt messages using a simple substitution cipher.
- Vigenère Cipher: Encrypt and decrypt messages using a more secure polyalphabetic cipher.
- Command-Line Interface: A CLI to easily interact with the implemented encryption and decryption functions.
To compile the project, use the provided Makefile:
makeThis will generate an executable named safecipher.
The CLI supports the following operations:
- Caesar Cipher
caesar-encryptcaesar-decrypt
- Vigenère Cipher
vigenere-encryptvigenere-decrypt
./project <operation> <key> <message>Encrypt a message using the Caesar cipher:
./project caesar-encrypt 3 HELLODecrypt a message using the Vigenère cipher:
./project vigenere-decrypt KEY RIJVSUYVJN- Caesar Cipher Key: Must be an integer value.
- Vigenère Cipher Key: Must consist of uppercase letters in the range 'A' to 'Z'.
caesar_encrypt: Encrypts a plaintext message using a given key.caesar_decrypt: Decrypts a ciphertext message using a given key.
vigenere_encrypt: Encrypts a plaintext message using a keyword.vigenere_decrypt: Decrypts a ciphertext message using a keyword.
cli: Handles user input and calls the appropriate encryption or decryption functions.
The project follows secure coding best practices:
- Proper input validation.
- Avoidance of buffer overflows.
- Clear error handling.
- Modular design to enhance maintainability and reduce security risks.
- Avoidance of dangerous functions (like gets() or atoi())