Sample code for 30+ languages & platforms
PowerShell

Example: Crypt2.EncryptSb method

Demonstrates how to call the EncryptSb method.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$crypt = New-Object Chilkat.Crypt2

$bdEncrypted = New-Object Chilkat.BinData
$sbPlainText = New-Object 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 -eq $false) {
    $($crypt.LastErrorText)
    exit
}