Hi javirufo,
See http://www.cryptopp.com/wiki/RSA.
Jeff
On 7/20/07, javirufo <[EMAIL PROTECTED]> wrote:
>
> thanks for response.
> Could you send me any example pls?
> Thanks
>
> On 19 jul, 23:54, cw <[EMAIL PROTECTED]> wrote:
> > have a look at the documentation for StringSource, it should be able
> > to do exactly what you're asking (unless I'm misunderstanding). for
> > output you can use StringSink or ArraySink.
> >
> > I highly recommend you avoid c strings, since you are likely to have
> > zeros in your data. hint hint, your code as-is will break even for
> > "strings", as you have a pretty good chance of having zeros in the
> > ciphertext, and when you return result.c_str() it will be truncated at
> > the first zero (similarly for passing in the ciphertext to your
> > decrypt function). I'm assuming that's not what you had intended.
> >
> > On Jul 19, 9:10 am, javirufo <[EMAIL PROTECTED]> wrote:
> >
> > > Hi all,
> > > i'm new to cryptopp and i'm learning to use RSA algorithms.
> > > Actually i've got this code.
> > > It appears to work fine, but only with strings. Now, i want this code
> > > to crypt any byte array. Can anybody help me? thanks.
> > > //--------------------------------------------------------------------------------//
> > > const char * cryptRSA(const char *pubFilename, const char *seed, const
> > > byte message size_t messageLen)
> > > {
> > > StringSource string1(pubFilename, true, new HexDecoder);
> >
> > > RSAES_OAEP_SHA_Encryptor pub(string1);
> >
> > > RandomPool randPool;
> > > randPool.Put((byte *)seed, strlen(seed));
> >
> > > string result;
> > > StringSource(message, messageLen, true, new
> > > PK_EncryptorFilter(randPool, pub, new HexEncoder(new
> > > StringSink(result))));
> > > return result.c_str();}
> >
> > > //--------------------------------------------------------------------------------//
> > > const char * decrypt char *privFilename, const char *ciphertext)
> > > {
> > > StringSource string1(privFilename, true, new HexDecoder);
> > > RSAES_OAEP_SHA_Decryptor priv(string1);
> >
> > > string result;
> > > StringSource(ciphertext, true, new HexDecoder(new
> > > PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result))));
> > > return result.c_str();
> >
> > > }
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---