#pragma once #include #include #include "bigint.h" namespace RSA{ struct PublicKey{ Bigint mod,exp; }; struct PrivateKey{ PublicKey pub; Bigint pexp; }; Bigint encrypt(const PublicKey &key,Bigint msg); Bigint decrypt(const PrivateKey &key,Bigint msg); PrivateKey genkey(int nbits); //nbits is target number of bits of modulus PrivateKey genkey(int nbits,const std::string &password); //generates key seeded by password std::pair exportkey(const PrivateKey&); //returns {pub,priv} PrivateKey importkey(const std::string &pub,const std::string &priv); }