Skip to content

A cipher tool that uses the RSA encryption algorithm, with a custom number precision library.

Notifications You must be signed in to change notification settings

michaelcanonizado/rsa-cipher-tool

Repository files navigation

RSA Cipher Tool

A cipher tool that uses the RSA (Rivest, Shamir, Adleman) encryption algorithm to generate keys, encrypt, and decrypt. It also uses a custom number precision library made from scratch!

Backstory

This is a 1st year capstone project for Computer Programming 2. This project was chosen as the members wanted to explore the complex algorithms used in cryptography and mathematical operations, while implementing the lessons learned this academic year. A custom number precision library was built to overcome the limitations of C's native data types. The current state of the precision library (bignum.h) is enough to efficiently handle a maximum of 128-bit RSA key size. Super small i know 😅. You can view the project instructions here.

Installation

Clone the repository

git clone https://github.com/michaelcanonizado/rsa-cipher-tool.git

Enter project directory

cd rsa-cipher-tool

Run executable file

./rsa-cipher-tool

Usage

The program is pretty straight forward, having 3 main actions: (1) Generating Keys, (2) Encrypting Text, and (3) Decrypting Text.

Therefore, upon running the program, you will be greeted with the following options:

image

1) - Generating Keys

You will be asked for your desired key size. The bigger the key size, the more secure the encrypted message will be, but the longer it will take to encrypt and decrypt. Smaller key sizes where implemented for the sake of demonstration, as the custom number precision library is not efficient enough to perform calculations on super large numbers. Further optimization can be made to bignum.h to enable it to handle longer key sizes efficiently.

image

After choosing a key size, the program will start generating the keys. They will be printed out in the screen, so make sure you properly copy and secure them before exiting!

image

2) - Encrypting text

Make sure to have the txt file you want to encrypt at the top most level of the directory!

image

Then simply enter the file name and the public key!

REMEMBER: Only the corresponding private key to the public key used to encrypt the text can decrypt it back to the original message! Ensure that you are using the right public key of the recipient or else they won't be able to decrypt back to the original message.

image

The encrypted file will be outputted as ./encrypted.txt, and can now be stored safely or be sent to the recipient.

image

3) - Decrypting text

Similar to encrypting, make sure to have the txt file you want to decrypt at the top most level of the directory!

image

Then simply enter the file name and the private key!

NOTE: Decrypting messages takes longer than encrypting as the private key is significantly longer than the public key.

image

The decrypted file will be outputted as ./decrypted.txt

image

About

A cipher tool that uses the RSA encryption algorithm, with a custom number precision library.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages