I was referring to the below, or more specifically this 
<https://stackoverflow.com/q/37163270/5099723>.

On Sunday, May 15, 2016 at 11:10:34 AM UTC-4, Jeffrey Walton wrote:
>
>
>
> On Tuesday, May 10, 2016 at 5:20:09 PM UTC-4, aeh wrote:
>>
>> I'm experiencing the exact same issue as: 
>> http://comments.gmane.org/gmane.comp.encryption.cryptopp/2518 
>>
>> In this case, because I'm using DefaultEncryptorWithMAC with AES-256, I 
>> get the exception "cannot decrypt message with this passphrase".   
>> Generally, 
>>
>> ---- 
>> std::string pdata; 
>> std::ifstream ifs(sFilePlainText.c_str(), std::ifstream::binary); 
>> std::ofstream ofs(sFileCipherText.c_str(), std::ofstream::binary); 
>>
>> m_enc = new Base64Encoder(NULL, true, 72); 
>> AlgorithmParameters params = MakeParameters(Name::Separator(), 
>>                 ConstByteArrayParameter("\n#"))         
>>                 (Name::InsertLineBreaks(), true); 
>> m_enc->IsolatedInitialize(params); 
>> m_enc->Attach(new FileSink(ofs)); 
>> m_dem = new DefaultEncryptorWithMAC((byte*)password.data(), 
>> password.size(), new Redirector(*m_enc)); 
>>
>> // ... ifs >> pdata ... 
>>
>> m_dem->Put2((byte const*)pdata.data(), pdata.size(), 0, true); 
>> m_dem->MessageEnd(); 
>>
>> ---- 
>>
>> Encrypts/decrypts fine within each OS. The encrypted output for each OS 
>> is different - Ubuntu's is smaller in size.  I've gone at this all day.   
>> Any help is appreciated. 
>>
>
> C++ fstreams can be problematic, even in binary mode. I seem to recall 
> there was some unwanted conversions going on, and I had to disable the 
> processing of whitespace for a time. Microsoft fstreams can be problematic, 
> especially when they are wide streams.
>
> First, ensure the fstreams are behaving as expected. Second, verify the 
> password is expected. There's a difference between encodings, code pages 
> and UTF-8. For password presentation to a lower lay like crypto, always use 
> UTF-8 because its portable across all platforms.
>
> Jeff
>

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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/d/optout.

Reply via email to