Skip to content

biorainy/r_s-a_C-h-a-t

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README for miniRSA Chat Project
Baichuan Li, Hui Jia
2012.04.19

Structure of our projects                							                                                                                                                                      
We are using Java as our programming language for this final project, and there are 7 classes in our RSAChat project.	
•	RSA.java
•	RSATest.java
•	Server.java
•	Client.java
•	ListenFor.java
•	SendMsg.java

Details of the Program                           						                                                                                                                                      
The details of each java class will be described as follows:
RSA: 
•	generate public key, private key etc. by getting the nth and mth prime from user
•	crack the private key by given a public key 
•	encrypt and decrypt messages using key pairs

Important methods:
coprime: pick a random integer that is coprime to the given input.
GCD: Computes the GCD of two numbers.
mod_inverse: (extendedGCD as helper method) Compute the modular inverse base^-1 % m
totient: Compute Euler’s totient
endecrypt: Given an integer representing an ASCII character value, encrypt it via the RSA crypto algorithm.
bruteDecrpt: Given public key and c_key, calculate and return the private key.


RSATest:
•	JUnit tests for the public methods in RSA.java

Server:
•	Created a server socket, when the connection is made with the client, send its own public key to server
•	After receiving public key pair from the partner, using the keys to encrypt message and send it to the client
•	If the client is using the key pair which is in server’s public key pair (hard coded in the program), server just use the its private key to decrypt the message from the client; else, automatically use the brute force method in the RSA to crack the private key and then decrypted the message.

Client:
•	Connect the Server by entering the server’s IP address
•	After receiving public key pair from the server, enter its own public key pairs
•	Using server’s keys to encrypt message and send it to the server
•	If the server is using the key pair which is in client’s public key pair (hard coded in the program), server just use the its private key to decrypt the message from the client; else, automatically use the brute force method in the RSA to crack the private key and then decrypted the message.


ListenFor:
•	Get message/request from the partner
•	Shared by both server and client

SendMsg:
•	Encrypted the message and send it to its partner
•	Shared by both server and client
*If you want to see the ciphertext for each character, please uncomment the code in line 37-42.

*Contributions:
For the RSA part, Baichuan Li is responsible for the totient and endecrypt and bruteDecrypt methods and tests, Hui Jia is responsible for the coprime, GCD and mod_inverse methods and tests. 
For the Server and Client part, Baichuan Li and Hui Jia are peer-programming.

How to Run Our Programs      								                                                                                                                                  
•	Server first created socket, and wait for the connection
•	Client decide which IP address wants to connect to, type “localhost” to just connect to the local host, or type particular IP address of the server
•	Once the connection is settled, server first type its public key pairs to client, then client type its public key pairs to server.
•	After that, server and client can communicate with each other
•	type .bye, both the client and server will quit

Sample Runs                  									                                                                                                                                       


 URL of Our Code Repository 								                                                                                                                                    
[email protected]:biorainy/r_s-a_C-h-a-t.git
Go to our GitHub link: https://github.com/biorainy/r_s-a_C-h-a-t/tree/master/src/rsaChat



	-

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages