src/net/cert/trial_comparison_cert_verifier.cc
bool CertHasMultipleEVPoliciesAndOneMatchesRoot(const X509Certificate* cert) {
  if (cert->intermediate_buffers().empty())
    return false;

  ParsedCertificateList certs = ParsedCertificateListFromX509Certificate(cert);
  if (certs.empty())
    return false;

  ParsedCertificate* leaf = certs.front().get();
  ParsedCertificate* root = certs.back().get();

  if (!leaf->has_policy_oids())
    return false;

  const EVRootCAMetadata* ev_metadata = EVRootCAMetadata::GetInstance();
  std::set<der::Input> candidate_oids;
  for (const der::Input& oid : leaf->policy_oids()) {
    if (ev_metadata->IsEVPolicyOIDGivenBytes(oid))
      candidate_oids.insert(oid);
  }

  if (candidate_oids.size() <= 1)
    return false;

  SHA256HashValue root_fingerprint;
  crypto::SHA256HashString(root->der_cert().AsStringPiece(),
                           root_fingerprint.data,
                           sizeof(root_fingerprint.data));

  for (const der::Input& oid : candidate_oids) {
    if (ev_metadata->HasEVPolicyOIDGivenBytes(root_fingerprint, oid))
      return true;
  }

  return false;
}
// Tests whether cert has multiple EV policies, and at least one matches the
// root. This is not a complete test of EV, but just enough to give a possible
// explanation as to why the platform verifier did not validate as EV while
// builtin did. (Since only the builtin verifier correctly handles multiple
// candidate EV policies.)
Tests whether cert has multiple EV policies, and at least one matches the
root. This is not a complete test of EV, but just enough to give a possible
explanation as to why the platform verifier did not validate as EV while
builtin did. (Since only the builtin verifier correctly handles multiple
candidate EV policies.)
Tests whether cert has multiple EV policies and at least one matches the root . This is not a complete test of EV but just enough to give a possible explanation as to why the platform verifier did not validate as EV while builtin did . ( Since only the builtin verifier correctly handles multiple candidate EV policies . )
bool CertHasMultipleEVPoliciesAndOneMatchesRoot(const X509Certificate* cert) {
  if (cert->intermediate_buffers().empty())
    return false;
  ParsedCertificateList certs = ParsedCertificateListFromX509Certificate(cert);
  if (certs.empty())
    return false;
  ParsedCertificate* leaf = certs.front().get();
  ParsedCertificate* root = certs.back().get();
  if (!leaf->has_policy_oids())
    return false;
  const EVRootCAMetadata* ev_metadata = EVRootCAMetadata::GetInstance();
  std::set<der::Input> candidate_oids;
  for (const der::Input& oid : leaf->policy_oids()) {
    if (ev_metadata->IsEVPolicyOIDGivenBytes(oid))
      candidate_oids.insert(oid);
  }
  if (candidate_oids.size() <= 1)
    return false;
  SHA256HashValue root_fingerprint;
  crypto::SHA256HashString(root->der_cert().AsStringPiece(),
                           root_fingerprint.data,
                           sizeof(root_fingerprint.data));
  for (const der::Input& oid : candidate_oids) {
    if (ev_metadata->HasEVPolicyOIDGivenBytes(root_fingerprint, oid))
      return true;
  }
  return false;
}
bool CertHasMultipleEVPoliciesAndOneMatchesRoot ( const X509Certificate * cert ) { if ( cert -> intermediate_buffers ( ) . empty ( ) ) return false ; ParsedCertificateList certs = ParsedCertificateListFromX509Certificate ( cert ) ; if ( certs . empty ( ) ) return false ; ParsedCertificate * leaf = certs . front ( ) . get ( ) ; ParsedCertificate * root = certs . back ( ) . get ( ) ; if ( ! leaf -> has_policy_oids ( ) ) return false ; const EVRootCAMetadata * ev_metadata = EVRootCAMetadata :: GetInstance ( ) ; std :: set < der :: Input > candidate_oids ; for ( const der :: Input & oid : leaf -> policy_oids ( ) ) { if ( ev_metadata -> IsEVPolicyOIDGivenBytes ( oid ) ) candidate_oids . insert ( oid ) ; } if ( candidate_oids . size ( ) <= 1 ) return false ; SHA256HashValue root_fingerprint ; crypto :: SHA256HashString ( root -> der_cert ( ) . AsStringPiece ( ) , root_fingerprint . data , sizeof ( root_fingerprint . data ) ) ; for ( const der :: Input & oid : candidate_oids ) { if ( ev_metadata -> HasEVPolicyOIDGivenBytes ( root_fingerprint , oid ) ) return true ; } return false ; }
Tests whether cert has multiple EV policies, and at least one matches the
root.
Tests whether cert has multiple EV policies and at least one matches the root .