1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 const certDB = Cc["@mozilla.org/security/x509certdb;1"].getService(
13 "SanctionsTestServer",
15 /* Don't try to load non-existent test-ca.pem */ false
18 addCertFromFile(certDB, "test_sanctions/symantec-test-ca.pem", "CTu,u,u");
20 // Add the necessary intermediates. This is important because the test server,
21 // though it will attempt to send along an intermediate, isn't able to reliably
22 // pick between the intermediate-other-crossigned and intermediate-other.
23 add_test(function () {
26 "test_sanctions/symantec-intermediate-allowlisted.pem",
31 "test_sanctions/symantec-intermediate-other.pem",
38 "symantec-not-allowlisted-before-cutoff.example.com",
39 MOZILLA_PKIX_ERROR_ADDITIONAL_POLICY_CONSTRAINT_FAILED,
45 "symantec-not-allowlisted-after-cutoff.example.com",
46 MOZILLA_PKIX_ERROR_ADDITIONAL_POLICY_CONSTRAINT_FAILED,
51 // Add a cross-signed intermediate into the database, and ensure we still get
52 // the expected error.
53 add_test(function () {
56 "test_sanctions/symantec-intermediate-other-crossigned.pem",
63 "symantec-not-allowlisted-before-cutoff.example.com",
64 MOZILLA_PKIX_ERROR_ADDITIONAL_POLICY_CONSTRAINT_FAILED,
69 // Load the Apple EE cert and its intermediate, then verify
70 // it at a reasonable time and make sure the allowlists work
71 add_task(async function () {
74 "test_sanctions/apple-ist-ca-8-g1-intermediate.pem",
77 let allowlistedCert = constructCertFromFile(
78 "test_sanctions/cds-apple-com.pem"
81 // Since we don't want to actually try to fetch OCSP for this certificate,
82 // (as an external fetch is bad in the tests), disable OCSP first.
83 Services.prefs.setIntPref("security.OCSP.enabled", 0);
85 // (new Date("2020-01-01")).getTime() / 1000
86 const VALIDATION_TIME = 1577836800;
88 await checkCertErrorGenericAtTime(
92 certificateUsageSSLServer,