thanks for the suggestions.

Here is the code i have written to use X509encodepublickey generated
form bouncycastle in crypto++,

string pubFilename;
string encodedpublickey;

   //decode base64encoded publickey bytes.
 
encodedpublickey.assign(base64_decode("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCLJ0tXB/
sQ2r5QtVDPL1kWqdvBhlef3/
Nw0izjBdrM9bKR6NqOgSHh6JCafeg0woXMzWUI027bOSKJwVM7QpO7gw3Y4weWE6eCNNOhtAfVrJgMyPnEWxpG3I24yOLd04XioLEJZuMx46fTbNQhtW6AyUZfpWAHYrpDOmfIjsgwTQIDAQAB"));

   byte *bt= new byte[encodedpublickey.length()];
  ::memcpy(bt,encodedpublickey.c_str(),encodedpublickey.length());

     //rebiuld the key
     Integer it(bt,encodedpublickey.length());
     HexEncoder pubFile(new FileSink(publicFilename.c_str()));
     it.DEREncode(pubFile);
     pubFile.MessageEnd();

    //encrytption code.
    FileSource pubFile(pubFilename.c_str(), true, new HexDecoder);
    RSAES_OAEP_SHA_Encryptor pub(pubFile);

    RandomPool randPool;
    randPool.Put((byte *)seed, strlen(seed));

    string result;
    StringSource(message, true, new PK_EncryptorFilter(randPool, pub,
new HexEncoder(new StringSink(result))));
    return result;









--~--~---------~--~----~------------~-------~--~----~
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