certMatchesIssuer method

bool certMatchesIssuer({
  1. Uint8List? childAki,
  2. Uint8List? issuerSki,
  3. Uint8List? issuerSerialBytes,
  4. String? issuerNameHash,
})

Pre-filter for issuer candidates based on AKI/SKI + serial/name hints.

IMPORTANT: this pre-filter never replaces final chain validation. This helper intentionally does not use CN/text matching.

Implementation

bool certMatchesIssuer({
  Uint8List? childAki,
  Uint8List? issuerSki,
  Uint8List? issuerSerialBytes,
  String? issuerNameHash,
}) {
  if (childAki != null && childAki.isEmpty) return false;
  if (issuerSki != null && issuerSki.isEmpty) return false;
  if (issuerSerialBytes != null && issuerSerialBytes.isEmpty) return false;
  if (issuerNameHash != null && issuerNameHash.trim().isEmpty) return false;

  if (childAki != null &&
      issuerSki != null &&
      !_bytesEqual(childAki, issuerSki)) {
    return false;
  }

  return true;
}