blob: bed840020544664e58c2f5a0393cec09c92b8a4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#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::pair<Key,Key> genkeys(int nbits,const std::string &password); //generates keys seeded by password
std::string exportKey(const Key&);
//throws invalid_argument if the imported key is of invalid format
Key importKey(const std::string &repr);
}
|