(AutoIt) Transition from RandomizeKey to GenRandomBytesENC
Provides instructions for replacing deprecated RandomizeKey method calls with GenRandomBytesENC. Note: This example requires Chilkat v11.0.0 or greater.
$oCrypt = ObjCreate("Chilkat.Crypt2")
$oCrypt.CryptAlgorithm = "aes"
$oCrypt.CipherMode = "cbc"
$oCrypt.KeyLength = 256
; ...
; ------------------------------------------------------------------------
; The RandomizeKey method is deprecated:
; Generates and sets a random 32-byte (256-bit) secret key.
$oCrypt.RandomizeKey
; ------------------------------------------------------------------------
; Do the equivalent using GenRandomBytesENC followed by SetEncodedKey
$oCrypt.EncodingMode = "base64"
Local $sRandomKeyBase64 = $oCrypt.GenRandomBytesENC(32)
$oCrypt.SetEncodedKey $sRandomKeyBase64,"base64"
|