Sample code for 30+ languages & platforms
Visual FoxPro

Example: Crypt2.DecryptStringENC method

Demonstrates how to call the DecryptStringENC method.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL loCrypt
LOCAL lcEncodedEncrypted
LOCAL lcOriginalText

* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loCrypt = CreateObject('Chilkat.Crypt2')

loCrypt.CryptAlgorithm = "aes"
loCrypt.CipherMode = "cbc"
loCrypt.KeyLength = 128
loCrypt.SetEncodedKey("000102030405060708090A0B0C0D0E0F","hex")
loCrypt.SetEncodedIV("000102030405060708090A0B0C0D0E0F","hex")
loCrypt.EncodingMode = "base64"

* Return the base64 encoded encrypted bytes
lcEncodedEncrypted = loCrypt.EncryptStringENC("Hello World!")
? "Encrypted: " + lcEncodedEncrypted

* Output:
* Encrypted: qiq+IFhcjTkEIkZyf31V/g==

* Decrypt
lcOriginalText = loCrypt.DecryptStringENC(lcEncodedEncrypted)

? "Decrypted: " + lcOriginalText

* Output:
* Decrypted: Hello World!

RELEASE loCrypt