blob: 8368768ec0449f24dd78004823a6cbf6025c9701 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#pragma once
#include <string>
#include <utility>
#include "bigint.h"
namespace RSA{
struct Key{
Bigint mod,exp;
};
Bigint encrypt(Bigint msg,const Key &key);
Bigint decrypt(Bigint msg,const Key &key);
std::pair<Key,Key> genkeys(int nbits); //nbits is target number of bits of modulus
std::string exportKey(const Key&);
//throws invalid_argument if the imported key is of invalid format
Key importKey(const std::string &repr);
}
|