I'm using Botan to generate a hash, perform encryption with AES256
, and now I want to perform asymmetric encryption with that. Reading this page: http://botan.randombit.net/pubkey.html.
I created a code to generate the public and private keys for RSA encryption, but I do not understand how to encrypt and decrypt data. Can someone help me?
I'm using Botan 1.8.8 2009-11-03
.
void generatekey()
{
LibraryInitializer init;
std::ostringstream pub;
std::ostringstream priv;
int bits = 1024;
AutoSeeded_RNG rng;
RSA_PrivateKey key(rng, bits);
pub << X509::PEM_encode(key);
priv << PKCS8::PEM_encode(key);
qDebug() << QString(pub.str().c_str());
qDebug() << QString(priv.str().c_str());
}