validateCertificate method
Implementation
@override
bool validateCertificate(
X509Certificate? cert,
String host,
int port,
Map<String, bool> fingerprints,
) {
// Check that the cert fingerprint matches the one we expect.
if (cert == null) {
return false;
}
// Validate it any way you want.
final fingerprint = sha256.convert(cert.der).toString();
if (fingerprint.isEmpty) {
return false;
}
// Validate
final hasMatches = customValidator.validate(cert, host, port);
return (fingerprints[fingerprint] == true) && hasMatches;
}