(Visual FoxPro) 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.
LOCAL loCrypt
LOCAL lcRandomKeyBase64
loCrypt = CreateObject('Chilkat.Crypt2')
loCrypt.CryptAlgorithm = "aes"
loCrypt.CipherMode = "cbc"
loCrypt.KeyLength = 256
* ...
* ------------------------------------------------------------------------
* The RandomizeKey method is deprecated:
* Generates and sets a random 32-byte (256-bit) secret key.
loCrypt.RandomizeKey()
* ------------------------------------------------------------------------
* Do the equivalent using GenRandomBytesENC followed by SetEncodedKey
loCrypt.EncodingMode = "base64"
lcRandomKeyBase64 = loCrypt.GenRandomBytesENC(32)
loCrypt.SetEncodedKey(lcRandomKeyBase64,"base64")
RELEASE loCrypt
|