Skip to content

antonarapin/rsa_encryption

Repository files navigation

This project contains four programs, including keygen, encrypt, decrypt, and factorial. Each program needs to be compiled individually using the directions listed below.


Keygen

To compile: make keygen

To run: ./keygen <numberone> <numbertwo> <publicfile> <privatefile>

The keygen program takes in two prime numbers and two text files as command line arguments. Public and private keys will be generated from the two prime numbers and . Public key will be written to the and private key will be written to the . Program will prompt the user if one or both passed in numbers are not prime or are too small. If passed in numbers are greater than 100000, they will not be checked for primality.


Encrypt

To compile: make encrypt

To run: ./encrypt <publickeyfile> <textfile> <encryptedfile>

The encrypt program takes in three file names as command line arguments. It uses the public key that is contained in and encrypts the phrase from the . The resulting encrypted message is written to the . In order for the program to encrypt the message, it should be written to the and should contain a pair of numbers which are the public key. Proper encryption is achieved when the message that is being encrypted is written in English letters. This encryption method is not secure enough and should not be used for practical purpouses or protection.


Decrypt

To compile: make decrypt

To run: ./decrypt <privatefile> <encryptedfile> <decryptedfile>

The decrypt program takes three file names as command line arguments. It uses private key from to decrypt the encrypted message contained in . The decrypted message is then written to the . For the proper decryption, private key should match the public key with which the message was encrypted.


Factorial

To compile: make factorial

To run: ./factorial <number>

The factorial program computes a fatorial of a given number. It takes in a single command liine argument integer, computes and prints out the factorial of the passed in .


About

RSA key generation, encryption and decryption

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published