File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -456,6 +456,16 @@ bool IsCertificateTrustValid(SecCertificateRef ref) {
456456 CFArrayCreateMutable (nullptr , 1 , &kCFTypeArrayCallBacks );
457457 CFArraySetValueAtIndex (subj_certs, 0 , ref);
458458
459+ // SecTrustEvaluateWithError is used to check whether an individual
460+ // certificate is trusted by the system — not to validate it for a
461+ // specific role (server, intermediate, etc.). We just need a minimal
462+ // policy that guarantees the certificate can be chained to a known
463+ // trust anchor while filtering out irrelevant certificates.
464+ //
465+ // Refs https://github.com/apple-oss-distributions/Security/blob/db15acbe6a7f257a859ad9a3bb86097bfe0679d9/OSX/sec/Security/SecPolicy.c#L1855-L1890
466+ // SecPolicyCreateSSL (both mark EKU optional):
467+ // server=true -> BasicX509 + serverAuth + anyExtendedKeyUsage + SGC
468+ // server=false -> BasicX509 + clientAuth + anyExtendedKeyUsage
459469 SecPolicyRef policy = SecPolicyCreateSSL (false , nullptr );
460470 OSStatus ortn =
461471 SecTrustCreateWithCertificates (subj_certs, policy, &sec_trust);
You can’t perform that action at this time.
0 commit comments