rsa-algorithm
所属分类:加密解密
开发工具:Java
文件大小:11KB
下载次数:0
上传日期:2020-05-08 15:15:47
上 传 者:
sh-1993
说明: 利用MR测试、FME测试、EA和EEA实现RSA算法
(Implementing RSA Algorithm using MR Test, FME Test, EA and EEA)
文件列表:
LICENSE (11347, 2020-05-08)
src (0, 2020-05-08)
src\rsa (0, 2020-05-08)
src\rsa\CreateRandom.java (2169, 2020-05-08)
src\rsa\FME.java (1389, 2020-05-08)
src\rsa\GenerateKeys.java (3077, 2020-05-08)
src\rsa\RSA.java (9287, 2020-05-08)
src\rsa\package-info.java (171, 2020-05-08)
# RSA Algorithm
- [x] Generating Key value pair with a multiple options for number of bits to choose
from.
- [x] Option to store Public and Private Key in .txt file.
- [x] Encrypts a message (also gives option to import key stored by the same program)
- [x] Option to store Encrypted Message in .txt file.
- [X] Decrypts a message (also gives option to import key stored by the same program)
## Implementation
#### I. Key Generation
> Using [CreateRandom Class](https://github.com/abhi-agrawl/rsa-algorithm/blob/master/src/rsa/CreateRandom.java)
- Get two different large prime numbers ***p*** and ***q***
- Using *Miller-Rabin Test*
> Using [GenerateKeys Class](https://github.com/abhi-agrawl/rsa-algorithm/blob/master/src/rsa/GenerateKeys.java)
- Let ***n*** = *p* * *q*
- Let ***φ(n)*** = *(p-1)* * *(q-1)*
- Choose a small, odd integer number ***e***, where 1 < e < φ(n)
and *e* is a co-prime to ***φ(n)***.
- Using *Euclidean Algorithm*
- Check *calculateEncryptionExponent()* method
- Calculate the integer number ***d***, where *e*d ≡ 1 mod φ(n) and 1 <
d < φ(n).
- Using *Extended Euclidean Algorithm*
- Check *calculateDecryptionExponent()* method
- [x] The public key of the RSA is the pair PK = (n, e)
- [x] The secret key of the RSA is the pair SK = (n, e)
#### II. Encryption
> Using [FME Class](https://github.com/abhi-agrawl/rsa-algorithm/blob/master/src/rsa/FME.java)
- To encrypt the message **m** (where m < n) using the public key ***PK = (n,
e)*** following formula is used: **(Fast Modular Exponent)**
```
c := EncPK(m) = m^e (mod n).
```
#### III. Decryption
> Using [FME Class](https://github.com/abhi-agrawl/rsa-algorithm/blob/master/src/rsa/FME.java)
- To decrypt the secret message ***c*** using the secret key ***d***
following formula is used: **(Fast Modular Exponent)**
```
m := DecSK(c) = c^d (mod n).
```
近期下载者:
相关文件:
收藏者: