Go
Go
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat Go Downloads
success := false
crypt := chilkat.NewCrypt2()
bdEncrypted := chilkat.NewBinData()
sbPlainText := chilkat.NewStringBuilder()
sbPlainText.Append("Text to be encrypted")
// ...
// Set the secret key ...
// Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
// Set the IV if needed ...
// ...
crypt.SetCharset("utf-8")
success = crypt.EncryptSb(sbPlainText,bdEncrypted)
if success == false {
fmt.Println(crypt.LastErrorText())
crypt.DisposeCrypt2()
bdEncrypted.DisposeBinData()
sbPlainText.DisposeStringBuilder()
return
}
crypt.DisposeCrypt2()
bdEncrypted.DisposeBinData()
sbPlainText.DisposeStringBuilder()