Skip to content

Instantly share code, notes, and snippets.

@11philip22
Created December 31, 2020 16:07
Show Gist options
  • Save 11philip22/8204c62fdbe8d7e842c643292eca5d07 to your computer and use it in GitHub Desktop.
Save 11philip22/8204c62fdbe8d7e842c643292eca5d07 to your computer and use it in GitHub Desktop.
c++ load rsa key from file using crypto++
template <typename Key>
const Key loadKey(const std::string& filename)
{
Key key;
CryptoPP::ByteQueue queue;
CryptoPP::FileSource file(filename.c_str(), true);
file.TransferTo(queue);
queue.MessageEnd();
key.Load(queue);
return key;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment