On Saturday, July 13, 2013 1:48:46 PM UTC+3, David Irvine wrote:
>
>
>
> On Sat, Jul 13, 2013 at 9:05 AM, Stefano Mtangoo 
> <[email protected]<javascript:>
> > wrote:
>
>>
>>
>> On Saturday, July 13, 2013 12:14:29 AM UTC+3, Stefano Mtangoo wrote:
>>>
>>> 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!
>>>
>> Any Idea as to what I do wrong? 
>>
>>>
>>> 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);
>>> }
>>>
>> I am rushing about just now, but there are some good examples here 
>> https://github.com/maidsafe/MaidSafe-Common/blob/master/src/maidsafe/common/crypto.cc
>>
>
> Hope that helps (there are more examples in utils and rsa in this lib) 
>
the code is great but its a bit complex for a newbie like me. I need just a 
simple encrypt/decrypt function. That is I can encrypt a file and then be 
able to read the contents(decrypt it). The test seems so much simple but 
its not working. I don't know why
I use Ubuntu! 

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