Skip to content

Commit ff5589a

Browse files
committed
Add revocation check fallback for PKIX based verification
In case of CRLDP and AIA extensions available in the certificate the PKIX verification flags do not allow to implement a fallback mechanism because the fallback remain active also for certificate with only one extension with unexpected behaviour. A more dynamic approach is introduced verifying the presence of the CRLDP extension and setting the flags accordingly.
1 parent 332041b commit ff5589a

File tree

1 file changed

+27
-4
lines changed
  • native/src/main/native/org/mozilla/jss/ssl

1 file changed

+27
-4
lines changed

native/src/main/native/org/mozilla/jss/ssl/common.c

+27-4
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,21 @@ CERTCertificate *getRoot(CERTCertificate *cert,
929929
return root;
930930
}
931931

932+
933+
/* Verify if the CRLDP extension is defined in the certificate. */
934+
static PRBool JSSL_isCRLDPExtensionInCert(CERTCertificate *cert)
935+
{
936+
SECStatus rv = CERT_FindCertExtension(cert,
937+
SEC_OID_X509_CRL_DIST_POINTS,
938+
NULL);
939+
if (rv == SECSuccess) {
940+
return PR_TRUE;
941+
}
942+
return PR_FALSE;
943+
}
944+
945+
946+
932947
/* Internal helper for the below call. */
933948
static SECStatus
934949
JSSL_verifyCertPKIXInternal(CERTCertificate *cert,
@@ -941,10 +956,10 @@ JSSL_verifyCertPKIXInternal(CERTCertificate *cert,
941956
*
942957
* When enabled the checking on the chained CA certificates.
943958
* With this policy the verification process does:
944-
* - if one between AIA and CRL-DP is present then it will be used;
945-
* - if AIA and CRL-DP are both presents only AIA is used and in case
946-
* freshin formation cannot be retrieved it fails the validation;
947-
* - it no AIA and CRL-DP are present no revocation check is performed.*/
959+
* - if only an AIA or an CRL-DP is present, the respective validation method is used;
960+
* - if AIA and CRL-DP are both presents the execution order is: AIA first followed by
961+
* CRL only in case OCSP endpoint does not provide fresh information;
962+
* - if no AIA and CRL-DP are present no revocation check is performed.*/
948963
PRUint64 ocsp_Enabled_Hard_Policy_LeafFlags[2] = {
949964
/* crl */
950965
CERT_REV_M_TEST_USING_THIS_METHOD |
@@ -963,6 +978,14 @@ JSSL_verifyCertPKIXInternal(CERTCertificate *cert,
963978
CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO
964979
};
965980

981+
/* if CRL-dp is present in the cert, disable CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO for ocsp */
982+
if (JSSL_isCRLDPExtensionInCert(cert)) {
983+
ocsp_Enabled_Hard_Policy_LeafFlags[1] =
984+
CERT_REV_M_TEST_USING_THIS_METHOD;
985+
ocsp_Enabled_Hard_Policy_ChainFlags[1] =
986+
CERT_REV_M_TEST_USING_THIS_METHOD;
987+
}
988+
966989
CERTRevocationMethodIndex ocsp_Enabled_Hard_Policy_Method_Preference[1] = {
967990
cert_revocation_method_ocsp
968991
};

0 commit comments

Comments
 (0)