Chilkat2-Python
Chilkat2-Python
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat Chilkat2-Python Downloads
import sys
import chilkat2
success = False
crypt = chilkat2.Crypt2()
bdEncrypted = chilkat2.BinData()
sbPlainText = chilkat2.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):
print(crypt.LastErrorText)
sys.exit()