Dart
Dart
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 Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final certStore = CkCertStore();
// This opens the Current User certificate store on Windows,
// On MacOS and iOS it opens the default Keychain.
final readOnly = false;
try {
certStore.openCurrentUserStore(readOnly);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
// Find the certificate having a Subject OU = "Secretaria da Receita Federal do Brasil - RFB".
final json = CkJsonObject();
final ou = 'Secretaria da Receita Federal do Brasil - RFB';
json.updateString('OU', ou);
final cert = CkCert();
try {
certStore.findCert(json, cert);
// Show the full distinguished name of the certificate.
print('Found: ${cert.subjectDN}');
} on ChilkatException {
print('Not found.');
}
}