Requirements
请用 Crypto++实现一 个程序,具有加密和解密两种功能。在用加密功能时,读出一个名为“key.txt” 的文件中的 1024 位的密钥,一个名为“plain.txt”的文件中的一段不超过 1000 位的明文,用 RSA 加密后,密文写入一个叫做“encrypted.txt”的文件。在用解密功能时,读出一个名为“key.txt”的文件中的 1024 位的密钥,一个名为 “encrypted.txt”的文件中的密文,用 RSA 解密后,密文写入一个叫做 “decrypted.txt”的文件。所有文件格式均为纯文本,密钥、明文、密文均用 二进制书写,形如“00111010…”。请提交全部源代码。
RSA_Encryption Description
key: 1024 bits from “key.txt”
plaintext: less than 1000 bits from “plain.txt”
ciphertext: “encrypted.txt”
Encryption: RSA
Description: RSA
recovered: “descrypted.txt”
Description
Organization
Source code
.
├── README.md
├── RSA.cpp
├── RSA_Gen.cpp
└── test
After executing ./test
Note:
- “test” contents a series of commands to complie and execute.
- Current user should own executable permissions on “test” (You may add
sudo
).
.
├── README.md
├── RSA
├── RSA.cpp
├── RSA_Gen
├── RSA_Gen.cpp
├── d.txt
├── descrypted.txt
├── e.txt
├── encrypted.txt
├── key.txt
├── plain.txt
└── test
Here is an example:
86 bits saved in plain.txt
43 byte(s) Random String Generated Successfully in plain.txt
1024 bits saved in key.txt
1024 bits saved in d.txt
8 bits saved in e.txt
Plaintext is the following:
xxxx
Encryption Success. Ciphertext is the following:
xxxx
Ciphertext is the following:
xxxx
Descryption Success. Plaintext is the following:
xxxx
Source Code
需要的朋友请留言!