(VBScript) Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Crypt2")
set crypt = CreateObject("Chilkat.Crypt2")
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.BinData")
set bdEncrypted = CreateObject("Chilkat.BinData")
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbPlainText = CreateObject("Chilkat.StringBuilder")
success = 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 = 0) Then
outFile.WriteLine(crypt.LastErrorText)
WScript.Quit
End If
outFile.Close
|