Sample code for 30+ languages & platforms
VB.NET

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim crypt As New Chilkat.Crypt2

Dim bdEncrypted As New Chilkat.BinData
Dim sbPlainText As New Chilkat.StringBuilder

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
    Debug.WriteLine(crypt.LastErrorText)
    Exit Sub
End If