Encrypts a string with AES encryption algorithm.
Usage:
aesEncryptString (object me, string key, string binaryString )
Parameters:
key (string) - A password to encode the file with. The key must be at least 8 characters long
binaryString (string) - The path to an existing file for encoding
Returns:
(string) - AES encrypted string
Example:
xtRose = xtra("rosetta").new()
strKey = "1234567812345678"
-- read input file
if ( xtRose.ioOpen( "c:\temp.txt", 1) > 0 ) then
strInput = xtRose.ioRead( xtRose.ioSize() )
end if
xtRose.ioClose( )
-- encrypt string
strEncrypted = xtRose.aesEncryptString(strkey, strInput)
-- write to output file
if ( xtRose.ioOpen( "c:\temp.enc", 2) > 0 ) then
xtRose.ioWrite( strEncrypted )
end if
xtRose.ioClose( )
Notes:
If you wish to make compatible decryption algorithm with other applications, the padding used is PKCS7 and the chaining mode used is ECB. Both the keysize and blocksize are 16 bytes.
See Also: