I use the Crypto++5.4 and wrote the following code to encrypt a file
by AES. It is ok for my computer(Windows XP, English OS).
However, when I run it in the computer which installed JAPANESE
Windows Vista, it catches an exception "FileSink: error opening file
for writing: C:\xyz.tmp".
Actually the error message show the yen symbol instead of the back
slash "\".
I think the FileSink cannot resolve the absolute path in Japanese OS.
I also try that if I use relative path(temp\abc.txt) instead of
absolute path, it runs successfully. It only fails for absolute
path(e.g. c:\abc.txt)
So hope any experts can help me. Your help is much appreciated.

Here is the source code:
CryptoPP::FileSource fsFileIn(strFileIn,true);
CryptoPP::FileSink *fsFileOut = new
CryptoPP::FileSink(strFileOut.c_str());

// Initialize Encryptor
CryptoPP::AES::Encryption aesEncryption((byte *) strPassword,
sizeof(strPassword) );
CryptoPP::CBC_Mode_ExternalCipher::Encryption
cbcEncryption( aesEncryption, (byte *)strIV  );

CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption,
fsFileOut );


while (fsFileIn.AnyRetrievable()==true) {
        intByteReceived=fsFileIn.Get(bytBuffer,intKeyLength);   //read from
file in
        stfEncryptor.Put(bytBuffer, intByteReceived);   //write encrypted data
to file out
}
stfEncryptor.MessageEnd();      //close the file out


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

Reply via email to