React Native
React Native
Find Certificate by Subject OU (Organizational Unit)
See more Cert Store Examples
Demonstrates how to find a certificate having the specified subject organizational unit (OU).Note: Requires Chilkat v10.1.2 or later.
Chilkat React Native Downloads
import { Cert, CertStore, JsonObject } from '@chilkat/react-native'
function chilkatExample() {
const certStore = new CertStore();
// This opens the Current User certificate store on Windows,
// On MacOS and iOS it opens the default Keychain.
const readOnly = false;
try {
certStore.openCurrentUserStore(readOnly);
} catch {
console.log(certStore.lastErrorText);
return;
}
// Find the certificate having a Subject OU = "Secretaria da Receita Federal do Brasil - RFB".
const json = new JsonObject();
const ou = 'Secretaria da Receita Federal do Brasil - RFB';
json.updateString('OU', ou);
const cert = new Cert();
try {
certStore.findCert(json, cert);
// Show the full distinguished name of the certificate.
console.log(`Found: ${cert.subjectDN}`);
} catch {
console.log('Not found.');
}
}