Sample code for 30+ languages & platforms
Visual FoxPro

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loCrypt
LOCAL loBdEncrypted
LOCAL loSbPlainText

lnSuccess = 0

loCrypt = CreateObject('Chilkat.Crypt2')

loBdEncrypted = CreateObject('Chilkat.BinData')
loSbPlainText = CreateObject('Chilkat.StringBuilder')

loSbPlainText.Append("Text to be encrypted")

* ...
* Set the secret key ...
* Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
* Set the IV if needed ...
* ...

loCrypt.Charset = "utf-8"

lnSuccess = loCrypt.EncryptSb(loSbPlainText,loBdEncrypted)
IF (lnSuccess = 0) THEN
    ? loCrypt.LastErrorText
    RELEASE loCrypt
    RELEASE loBdEncrypted
    RELEASE loSbPlainText
    CANCEL
ENDIF

RELEASE loCrypt
RELEASE loBdEncrypted
RELEASE loSbPlainText