diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-10-08 22:03:52 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-10-08 22:03:52 +0200 |
commit | d6cc28665d2025afba1f3701a486927f0b3a51da (patch) | |
tree | 86e6723fda17b705bb2cc61abc7c1ffd43463706 /rsa.h | |
parent | 93b1a18fd61890eb4976a7f52d17e0990ccca661 (diff) |
Lots of renaming (mainly {Public,Private}Key -> Key)
Diffstat (limited to 'rsa.h')
-rw-r--r-- | rsa.h | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -6,22 +6,19 @@ namespace RSA{ - struct PublicKey{ + struct Key{ Bigint mod,exp; }; - struct PrivateKey{ - PublicKey pub; - Bigint pexp; - }; + Bigint encrypt(Bigint msg,const Key &key); + Bigint decrypt(Bigint msg,const Key &key); - Bigint encrypt(Bigint msg,const PublicKey &key); - Bigint decrypt(Bigint msg,const PrivateKey &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 - 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::string exportKey(const Key&); - std::pair<std::string,std::string> exportkey(const PrivateKey&); //returns {pub,priv} - PrivateKey importkey(const std::string &pub,const std::string &priv); + //throws invalid_argument if the imported key is of invalid format + Key importKey(const std::string &repr); } |