Sample code for 30+ languages & platforms
B4X

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

Dim crypt As ChilkatCrypt2
crypt.Initialize("crypt")

Dim bdEncrypted As ChilkatBinData
bdEncrypted.Initialize
Dim sbPlainText As ChilkatStringBuilder
sbPlainText.Initialize

sbPlainText.Append("Text to be encrypted")

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

crypt.Charset = "utf-8"

success = crypt.EncryptSb(sbPlainText, bdEncrypted)
If success = False Then
    Log(crypt.LastErrorText)
    Return
End If