Previous - aesEncryptString Section Home - AES Encryption/Decryption Next - Base64 Conversion


aesDecryptString ( )

Decrypts a string with AES encryption algorithm

Usage:

aesDecryptString (object me, string key, string binaryString)

Parameters:

key (string) - A password to decode the file with. The key must be at least 8 characters long

binaryString (string) - The path to an existing file for encoding

Returns:

(string) - Decrypted AES string

Example:

xtRose = xtra("rosetta").new()
strKey = "1234567812345678"

-- read encrypted file
if ( xtRose.ioOpen( "c:\temp.enc", 1) > 0 ) then
  strInput2 = xtRose.ioRead( xtRose.ioSize() )
end if
xtRose.ioClose( )

-- decrypt string
strDecrypted = xtRose.aesDecryptString(strkey, strInput2 )

-- write to output file
if ( xtRose.ioOpen( "c:\temp2.txt", 2) > 0 ) then
  xtRose.ioWrite( strDecrypted )
end if
xtRose.ioClose( )


Notes:

If you wish to make compatible encryption 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:

ioOpen, ioRead, ioWrite

 


Previous - aesEncryptString Section Home - AES Encryption/Decryption Next - Base64 Conversion