Decrypts a file encoded with AES encryptions
Usage:
aesDecryptFile (object me, string key, string filePathSource, string filePathTarget)
Parameters:
key (string) - A password to decode the file with. The key must be at least 8 characters long
filePathSource (string) - The path to an existing file for encoding
filePathTarget (string) - The path to save the encoded file.
Returns:
(integer) - The success code
Example:
-- example shows the reverse of the dirMemExport example
-- A zip file containing encrypted and compressed data is extracted and imported back into Director
xtRose = xtra("Rosetta").new( )
-- use MD5 to create a really long unique key
strKey = xtRose.md5String( "example" )
-- get the system temp folder
strTmpFolder = xtRose.sysFolderTemp( )
-- extract the zip file, and traverse though each file
xtRose.uZipOpen( the moviepath & "UserSaveData.zip" )
nCount = xtRose.uZipCount( )
Repeat with i = 1 to nCount
strFileName = xtRose.uZipGetItemName( i )
xtRose.uZipItem( i, strTmpFolder & strFileName )
-- make temp name, and decrypt into temp file
strTmpFilePath = xtRose.sysFileTemp( strTmpFolder, "caluRose" )
xtRose.aesDecryptFile( strKey, strTmpFolder & strFileName, strTmpFilePath )
-- import the decrypted file back into a Director cast member
xtRose.dirMemImport( member( 100+i, "internal" ), strTmpFilePath )
-- delete the temp files
xtRose.sysFileDelete( strTmpFilePath )
xtRose.sysFileDelete( strTmpFolder & strFileName )
End Repeat
-- close the unzip file
xtRose.uZipClose( )
Notes:
For compatibility with other applications, developers are urged to use the new functions: aesEncryptString and aesDecryptString. These 2 new functions can create compatible encoding with applications created in Java, C++ and will be cross-platform compatible for use on the Macintosh.
See Also:
aesEncryptString, aesDecryptString, md5String , b64decode, zipCreate