Skip to content

Commit 093ac1c

Browse files
committed
edit readme and readme assets
finish
1 parent d1a6944 commit 093ac1c

File tree

5 files changed

+56
-8
lines changed

5 files changed

+56
-8
lines changed

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1-
# rsa-cryptography-algorithm-example
1+
# RSA Cryptography Algorithm Simulation
2+
3+
4+
***Asymmetric Encryption***
5+
6+
RSA (Rivest-Shamir-Adleman) is an asymmetric encryption algorithm that uses two different keys: a public key and a private key. Data encrypted with the public key can only be decrypted by the corresponding private key. This makes RSA ideal for secure data transmission, digital signatures, and authentication.
7+
8+
*In this project, RSA encryption is used to encrypt files in various scenarios. The backend is developed with Java Spring Boot to handle the API, and the frontend uses React to simulate and provide a user interface for encrypting and decrypting files, allowing users to interact with the encryption process in real-time.*
9+
10+
<img src="./readme/rsa_algorithm_exp.png" width=100% />
11+
12+
13+
### Scenario/3 gif
14+
<img src="./readme/rsa.gif" width=100% />
15+
16+
### Installation
17+
```sh
18+
git clone https://github.com/zahidayturanrsa-cryptography-algorithm-example.git
19+
cd rsa-cryptography-algorithm-example
20+
21+
cd rsa-backend
22+
mvn clean install
23+
24+
Edit the rsa-backend/src/main/resources/application.properties file according to your own information
25+
26+
cd ../rsa-frontend
27+
npm install
28+
29+
Create and edit the rsa-frontend/.env file as follows:
30+
REACT_APP_API_BASE_URL=http://localhost:8080 (probably)
31+
32+
cd rsa-backend
33+
mvn spring-boot:run
34+
35+
cd ../rsa-frontend
36+
npm start
37+
38+
Visit http://localhost:3000 in your browser to explore RSA.
39+
```
40+
If you encounter any issues during setup, please report an issue. Feel free to adjust any placeholders or specific details as needed!
41+
42+
43+
## How can I support developers?
44+
- Star this GitHub repo
45+
- Create pull requests, submit bugs, suggest new features or documentation updates
46+
- Follow my work

readme/rsa.gif

27.7 MB
Loading

readme/rsa_algorithm_exp.png

2.99 MB
Loading

rsa-backend/src/main/java/com/example/rsa/service/RSAEncryptionService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ private void initializeKeys() {
2323
int bitLength = 2048;
2424
BigInteger p = BigInteger.probablePrime(bitLength, random);
2525
BigInteger q = BigInteger.probablePrime(bitLength, random);
26+
System.out.println("First prime number (p) :"+p);
27+
System.out.println("Second prime number (q) :"+q);
2628

2729
n = p.multiply(q);
30+
System.out.println("Mode value (n):"+n);
2831
BigInteger phi = (p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE));
2932

3033
// Public Key
@@ -36,8 +39,8 @@ private void initializeKeys() {
3639
// Private Key
3740
d = e.modInverse(phi);
3841

39-
System.out.println("Public Key :"+e);
40-
System.out.println("Private Key :"+d);
42+
System.out.println("Public Key (e) :"+e);
43+
System.out.println("Private Key (d) :"+d);
4144
}
4245

4346
public BigInteger encrypt(BigInteger message) {

rsa-frontend/src/routes/components/ScenarioArea.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ const UserContainer = ({ userId }) => {
121121
setLoading(true);
122122
const file = event.target.files[0];
123123
if (file) {
124-
if (file.size > 512) {
125-
toast.error("Dosya boyutu 512 byte'ı geçemez. Lütfen daha küçük bir dosya yükleyin.");
124+
if (file.size > 256) {
125+
toast.error("Dosya boyutu 256 byte'ı geçemez. Lütfen daha küçük bir dosya yükleyin.");
126126
setLoading(false);
127127
return;
128128
}
@@ -139,7 +139,7 @@ const UserContainer = ({ userId }) => {
139139
'Content-Type': 'multipart/form-data'
140140
}
141141
}).then(response => {
142-
toast.success("Dosya başarıyla yüklendi");
142+
toast.success("Dosya başarıyla yüklendi. Şifrelendi.");
143143
console.log("Dosya başarıyla yüklendi:", response.data);
144144
})
145145
.catch(error => {
@@ -178,7 +178,7 @@ const UserContainer = ({ userId }) => {
178178
'Content-Type': 'multipart/form-data'
179179
}
180180
}).then(response => {
181-
toast.success("Dosya başarıyla yüklendi");
181+
toast.success("Dosya başarıyla yüklendi. Şifrelendi.");
182182
console.log("Dosya başarıyla yüklendi:", response.data);
183183
closeUserSelectModal();
184184
}).catch(error => {
@@ -280,7 +280,7 @@ const UserContainer = ({ userId }) => {
280280
</p>
281281
<div className={"user-operation-button"}
282282
style={{ backgroundColor: user.fileUpload && "rgb(0,176,176)", cursor: user.fileUpload && "pointer" }}
283-
onClick={() => document.getElementById(`fileInput-${user.id}`).click()}
283+
onClick={() => user.fileUpload ? document.getElementById(`fileInput-${user.id}`).click() : null}
284284
>
285285
Dosya Yükle
286286
</div>

0 commit comments

Comments
 (0)