Thanks Jeffrey,

but I have already test this code example, it's this piece of code:

string RSADecryptString(const char *privFilename, const char
*ciphertext)
{
FileSource privFile(privFilename, true, new HexDecoder);
RSAES_OAEP_SHA_Decryptor priv(privFile);

string result;
StringSource(ciphertext, true, new HexDecoder(new
PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result))));
return result;
}

but this code doesn't work with my private key and ciphertext ,

this private key and ciphertext was generated by a Java application ( with
JCE package cryptography ), it seems that CryptoPP have maybe a problem if
privatekey and ciphertext are created by Java applications ?

you can help me by this way: I send you with this mail 2 files that
represent
the privateKey and the ciphertext in binary format ( pure format, not text
format )

can you tell me if you can decrypt the ciphertext with cryptoPP ?

 thanks



"Jeffrey Walton" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi Gordon,
>
> The followinf is taken from 5.2.1's test.cpp:
>
> void GenerateRSAKey(unsigned int keyLength, const char *privFilename,
> const char *pubFilename, const char *seed)
> {
> RandomPool randPool;
> randPool.Put((byte *)seed, strlen(seed));
>
> RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength);
> HexEncoder privFile(new FileSink(privFilename));
> priv.DEREncode(privFile);
> privFile.MessageEnd();
>
> RSAES_OAEP_SHA_Encryptor pub(priv);
> HexEncoder pubFile(new FileSink(pubFilename));
> pub.DEREncode(pubFile);
> pubFile.MessageEnd();
> }
>
> string RSAEncryptString(const char *pubFilename, const char *seed,
> const char *message)
> {
> FileSource pubFile(pubFilename, 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;
> }
>
> string RSADecryptString(const char *privFilename, const char
> *ciphertext)
> {
> FileSource privFile(privFilename, true, new HexDecoder);
> RSAES_OAEP_SHA_Decryptor priv(privFile);
>
> string result;
> StringSource(ciphertext, true, new HexDecoder(new
> PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result))));
> return result;
> }
>
>>>> [EMAIL PROTECTED] 2/8/2006 3:25 PM >>>
> Hi,
>
> I am a newbie with cryptoPP
>
> I am trying to decrypt a string that was crypted in RSA
>
> but it doesn't work, I have an exception that say "Invalid
> ciphertext",
>
> in my program the RSA private key was succesfully loaded, but when the
>
> program try to decrypt the ciphertext it doesn't work
>
> I am sure that the ciphertext is Ok, so I don't understand, I need help
>
> please
>
> here my source code:
>
> std::string Crypto::RSADecryptString( const char *privKey, const char
>
> *ciphertext){
>
>        //privKey is the privateKey, in hexadecimal format
>   StringSource privFile(privKey, true, new HexDecoder);
>   RSAES_OAEP_SHA_Decryptor priv(privFile);
>
>          //here we try to decrypt a ciphertext, here ciphertext is in
>
> hexadecimal format
>        RandomPool randomPool;
>   string result;
>         StringSource(ciphertext, true, new HexDecoder(new
> PK_DecryptorFilter(randomPool, priv, new StringSink(result))));
>   return result;
>
> }
>
> can you send me a source code who explain the encryption/decryption
> method
> for RSA ?
>
> thanks
>
>
>
>




begin 666 files.zip
M4$L#! [EMAIL PROTECTED](:A2#0I>#C>>@(``'H"```.````<')I=F%T96ME>2YB:6XP
M@@)[EMAIL PROTECTED], T&"2J&2(;W#0$!`04`!(("8#""`EP"`0`"@8$`V-7!-(0H?[P'
MMQ'[X.^O<O07]T=S5HZ5%K_V[4^G=<M<SDS<Y!2]M]AD3+FV*%R(PEU9P.#?
M$WMX=C<Z]X^#(.9&E/<Q>L-KAF0MVF"R'*40.&A)>"SJ':"[HSK6&A(1+/\X
MQ3JYP]$J&IC:+!)-^?.4EMV/PN,-C;_$/(;'0ZT"[EMAIL PROTECTED]>1Y$FIM;
[EMAIL PROTECTED])9_T]4K')K%%HY&0\T,<U*X($,Z1#S'-,*L,SZ\HJ=R7_8D#5(=<6X
MO]+))FA5F04-TEA"W^U.IBXLJ.;=(0<)M>U16'X!46G:?"TO1=]LQ:R$PA7P
MHE8V>#]=;N%J3>]_;WNA[9 N&^3]4]P^<T691(M4[0)!`.UMZ#:TC,F]>2+$
M=6(>70007'_"%>9=FUAM($2=I!EYDU[]$GO[%:FAFXZLFQ1-FE7P@)[12_6B
MCXRVYZ@&.8L"00#IRWNL1S,<PU^)$.PPD"RK7%%'LE"5(P!J#0Y+J.SYY^W=
M0\$/=\^[P#O ^:[,/@F/GYH0=8 2E>>I;[EMAIL PROTECTED](58SR5HKE%LZES05
MPDGHN4RKV+R94M&/7ZBP3;G9G=#V8]IOA/I+W2F>,APXAGWIY]JK9LM$A18K
MCLTK+!T5`D 6M-&-&-DH^/RE5D1J+P9WFAZVQ.6XIDZ:_BN>0XC(>+,,8U$S
MS&(;C/\`K?]!#.%FUHQB_M9R=Z:I..;?`A5/`D /[EMAIL PROTECTED]&O8;U1F8
M;129'XP*Q^>7:XOI.I8P?_"'M$F(KYAO;O;/-2\^D5,6V?UE.^S[3(Z"]F>+
M2HE=4$L#! [EMAIL PROTECTED](:A2#0$&'[EMAIL 
PROTECTED]($````.````8VEP:&5R=&5X="YB
M:6X`M##RJ^HMKX8N.EK&$C,/OU#_1?>AN0ES.U>;.DJYVCC=%""W]-[U`,&?
M=$ZIZ [EMAIL PROTECTED]/[EMAIL PROTECTED]>5K8&WPLA:[EMAIL PROTECTED])9Q9
M"[EMAIL PROTECTED],_+\BV7FSUF8'")=L8K^^!L;/ZTR.&3ZBV$E=(W&>?F+U/86#0E02P$"
M% `*``(```"&[EMAIL PROTECTED]@XWGH"[EMAIL PROTECTED]@```````````" `````````<')I
M=F%T96ME>2YB:6Y02P$"% `*``(```"&[EMAIL PROTECTED]"[EMAIL PROTECTED]
M`````" ```"[EMAIL PROTECTED]:&5R=&5X="YB:6Y02P4&``````([EMAIL PROTECTED],`
#````
`
end


Reply via email to