-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathio.cpp
More file actions
31 lines (25 loc) · 681 Bytes
/
Copy pathio.cpp
File metadata and controls
31 lines (25 loc) · 681 Bytes
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
#include <iostream>
#include "io.h"
using namespace std;
key_pair IO::read_key(const string & filename) {
Numbers numbers;
string number;
key_pair pair;
ifstream key_file(filename.c_str(), ios::in);
if (key_file.good()) {
for (integer i = 0; i < 2; i++) {
getline(key_file, number);
pair.push_back( stringToBigUnsigned(number) );
}
key_file.close();
} else {} // TODO!
return pair;
}
void IO::write_key(const string & filename, const bignum & n, const bignum & e) {
Numbers numbers;
ofstream key_file(filename.c_str(), ios::out);
if (key_file.good()) {
key_file << numbers.to_s(n) << endl << numbers.to_s(e);
key_file.close();
} else {} // TODO!
}