React Native
React Native
Example: Crypt2.SetDecryptCert method
Demonstrates how to call the SetDecryptCert method.Chilkat React Native Downloads
import { BinData, Cert, Crypt2 } from '@chilkat/react-native'
function chilkatExample() {
const cert = new Cert();
try {
cert.loadPfxFile('c:/pfx_files/my.pfx', 'password');
} catch {
console.log(cert.lastErrorText);
return;
}
const decrypt = new Crypt2();
decrypt.cryptAlgorithm = 'pki';
try {
decrypt.setDecryptCert(cert);
} catch {
console.log(decrypt.lastErrorText);
return;
}
const bd = new BinData();
bd.loadFile('c:/someDir/pkcs7_encrypted.dat');
try {
decrypt.decryptBd(bd);
} catch {
console.log(decrypt.lastErrorText);
return;
}
// bd contains the decrypted content.
}