Node.js
Node.js
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var crypt = new chilkat.Crypt2();
var bdEncrypted = new chilkat.BinData();
var sbPlainText = 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) {
console.log(crypt.LastErrorText);
return;
}
}
chilkatExample();