# crypto++ 5 and RSA encryption/decryption problem

*From*: si <nomail@xxxxxxxx>*Date*: Fri, 31 Mar 2006 13:40:56 +0200

Hello

I'm trying to implement encryption/decryption using RSA. The problem is that all samples I have found in the Internet refer to crypto++ version 4.x.

Version 5 have important changes, for example the sample code below (found on codeproject.como) doesn't work at all:

FileSource privFile(privFilename, true, new HexDecoder);

RSAES_OAEP_SHA_Decryptor priv(privFile);

HexDecoder hexDecoder;

hexDecoder.Put((byte *)ciphertext, strlen(ciphertext));

hexDecoder.MessageEnd();

SecByteBlock buf(priv.CipherTextLength());

hexDecoder.Get(buf, priv.CipherTextLength());

char *outstr = new char[priv.MaxPlainTextLength()+1];

unsigned messageLength = priv.Decrypt(buf, (byte *)outstr);

outstr[messageLength] = 0;

CString csRet(outstr);

delete [] outstr;

return csRet;

becuase methods like CipherTextLength, MaxPlainTextLength and Decrypt do not exist anymore (unless I'm doing something wrong).

The tutorial on the project's website still refers to version 4.x. I'm stuck. Please advise.

Thanks

si

.

**Follow-Ups**:**Re: crypto++ 5 and RSA encryption/decryption problem***From:*tomstdenis

- Prev by Date:
**Re: RSA decryption exponent d (c++)** - Next by Date:
**Re: Explaining One-time pads?** - Previous by thread:
**RSA decryption exponent d (c++)** - Next by thread:
**Re: crypto++ 5 and RSA encryption/decryption problem** - Index(es):