-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore_test.cpp
More file actions
36 lines (32 loc) · 1.21 KB
/
Copy pathstore_test.cpp
File metadata and controls
36 lines (32 loc) · 1.21 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
#include "DET.h"
#include "OPE.h"
#include "RND.h"
#include "util.h"
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
int num;
while (1) {
cout << "-------------START----------" << endl;
cout << "input num: ";
cin >> num;
DET det;
det.recover_key_iv("key/l1_key_det", "key/det_iv");
string cipher_det = det.Encrypt_int(num);
cout << "cipher_det: " << cipher_det << endl;
store_str(cipher_det, "data/cipher_det");
cout << "decrypt cipher_det to plaintext: " << det.Decrypt_int(cipher_det) << endl << endl;
OPE ope;
string cipher_ope = ope.Encrypt_int(num);
cout << "cipher_ope: " << cipher_ope << endl;
store_str(cipher_ope, "data/cipher_ope");
cout << "decrypt cipher_ope to plaintext: " << ope.Decrypt_int(cipher_ope) << endl << endl;
RND rnd;
rnd.recover_keys("key/l2_key_det", "key/l2_key_ope");
string cipher_rnd = rnd.Encrypt(cipher_det, cipher_ope);
cout << "cipher_rnd: " << cipher_rnd << endl << endl;
cout << "decrypt cipher_rnd to cipher_det: " << rnd.Decrypt(cipher_rnd, rnd.keys[0]) << endl;
cout << "decrypt cipher_rnd to cipher_ope: " << rnd.Decrypt(cipher_rnd, rnd.keys[1]) << endl;
}
return 0;
}