-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCryptoSystem.h
More file actions
39 lines (32 loc) · 1.15 KB
/
CryptoSystem.h
File metadata and controls
39 lines (32 loc) · 1.15 KB
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
//
// Created by mmbil on 10/05/2023.
//
#ifndef INC_159342_A2_CRYPTOSYSTEM_H
#define INC_159342_A2_CRYPTOSYSTEM_H
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random.hpp>
namespace rd = boost::random;
namespace mp = boost::multiprecision;
class CryptoSystem {
private:
mp::cpp_int z;
mp::cpp_int e;
mp::cpp_int n;
mp::cpp_int d;
public:
CryptoSystem();
void generate_rsa_key(mp::cpp_int p, mp::cpp_int q);
void generate_fixed_rsa_key(mp::cpp_int p, mp::cpp_int q);
mp::cpp_int euclidean_algo(mp::cpp_int x, mp::cpp_int y);
mp::cpp_int extended_euclidean_algo(mp::cpp_int z, mp::cpp_int e);
mp::cpp_int get_rand_num();
mp::cpp_int encrypt_rsa(mp::cpp_int m, mp::cpp_int e, mp::cpp_int n);
mp::cpp_int decrypt_rsa(mp::cpp_int m, mp::cpp_int d, mp::cpp_int n);
mp::cpp_int encrypt_rsa_cbc(mp::cpp_int m, mp::cpp_int e, mp::cpp_int n, mp::cpp_int rand);
mp::cpp_int decrypt_rsa_cbc(mp::cpp_int m, mp::cpp_int d, mp::cpp_int n, mp::cpp_int rand);
mp::cpp_int get_e();
mp::cpp_int get_n();
mp::cpp_int get_d();
};
#endif //INC_159342_A2_CRYPTOSYSTEM_H