React Native
React Native
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat React Native Downloads
import { BinData, Crypt2, StringBuilder } from '@chilkat/react-native'
function chilkatExample() {
const crypt = new Crypt2();
const bdEncrypted = new BinData();
const sbPlainText = new 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';
try {
crypt.encryptSb(sbPlainText, bdEncrypted);
} catch {
console.log(crypt.lastErrorText);
return;
}
}