Hi All,

I'm trying to retrieve a RSA (OAEP using SHA) public key from string
using Base64Decoder, and having problem.

First function, I created a keypair, base64 encode and save in string
as follows:

---------------
AutoSeededRandomPool rng;
byte randomBytes[256];
rng.GenerateBlock(randomBytes, 256);

RSAES_OAEP_SHA_Decryptor priv(rng, 2048 /*, e*/);
RSAES_OAEP_SHA_Encryptor pub(priv);

string privKey, pubKey;
priv.AccessKey().Save(Base64Encoder(new StringSink(privKey)));
pub.AccessKey().Save(Base64Encoder(new StringSink(pubKey)));
---------------

Then in second function, I tried to retrieve a public key from string
using base64decoder as follows:

---------------
Base64Decoder decoder;
decoder.Put((byte*)pubKey.c_str(), pubKey.size());
decoder.MessageEnd();

RSAES_OAEP_SHA_Encryptor pub;
pub.AccessKey().Load(decoder);
---------------

At the runtime, when it reached "pub.AccessKey().Load(decoder);" core
dumped.
If I use HexEncoder/Decoder, it works. Is the Base64 having problem or
the way I'm using is wrong?

I hope somebody can share the knowledge. I'm using crypto++ 5.5.2.

Regards,
Aung

-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.

Reply via email to