Hi,
I wanted to Encrypt my file so I checked the Test and the decrypt functions 
there does not work or at least I cannot get them work.
First I tried the EncryptFile and it works fine but decryptfile fails. And 
then I tried encryptString and works fine but the counterpart does not!
They all fail with error: "DefaultDecryptor: cannot decrypt message with 
this passphrase"

I use the same passphrase (#define PASS "SomePassword"

I'm stucked!

Code:

wxString DecryptString(const wxString& instr, const wxString& passPhrase)
{


    std::string outstr;
    const char* charToDecrypt = instr.ToStdString().c_str();
    const char* pass = passPhrase.ToStdString().c_str();

    try
    {
        CryptoPP::HexDecoder decryptor(new 
CryptoPP::DefaultDecryptorWithMAC(pass, new CryptoPP::StringSink(outstr)));
        decryptor.Put((byte *)charToDecrypt, strlen(charToDecrypt));
        decryptor.MessageEnd();
    }
    catch (CryptoPP::Exception& e)
    {
        wxPuts(e.what());
    }

    return wxString(outstr);
}

-- 
-- 
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.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to