Dart
Dart
Iterate over Certificates in a Certificate Store
See more Cert Store Examples
Demonstrates how to iterate over the certificates in a certificate store.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;
}
final cert = CkCert();
final numCerts = certStore.numCertificates;
var i = 0;
while (i < numCerts) {
// Load the cert object with the Nth certificate.
certStore.getCert(i, cert);
print('$i: ${cert.subjectCN}');
i++;
}
}