-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodern_rsa.h
44 lines (34 loc) · 1.07 KB
/
modern_rsa.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef MODERN_RSA_H
#define MODERN_RSA_H
#include "biginteger.h"
#include "cryptobase.h"
#include <omp.h>
class Modern_RSA : public CryptoBase
{
private:
BigInteger p, q, n;
BigInteger Public_Key;
BigInteger Private_Key;
BigInteger eul_func;
void init(const unsigned);
BigInteger RSA_Encryption(const BigInteger &);
BigInteger RSA_Decryption(const BigInteger &);
BigInteger createOddNum(unsigned);
BigInteger createPrime(unsigned, int);
bool isPrime(const BigInteger &, const unsigned);
BigInteger createRandomSmallNumber(const BigInteger &);
void createExponent(const BigInteger &);
bool valid(const QString &);
public:
Modern_RSA(); //用于加密解密
Modern_RSA(const unsigned len) { init(len); } //用于生成密钥对
QString getPublicKey();
QString getBigN();
QString getPrivateKey();
bool setPublicKey(const QString &);
bool setPrivateKey(const QString &);
bool setN(const QString &);
bool DecryptionText() override;
bool EncryptionText() override;
};
#endif // MODERN_RSA_H