(Visual FoxPro) Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.
LOCAL loCrypt
LOCAL lnSuccess
LOCAL loBdEncrypted
LOCAL loSbPlainText
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Crypt2')
loCrypt = CreateObject('Chilkat.Crypt2')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData')
loBdEncrypted = CreateObject('Chilkat.BinData')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
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
|