1 // -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
2 // This Source Code Form is subject to the terms of the Mozilla Public
3 // License, v. 2.0. If a copy of the MPL was not distributed with this
4 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 // Tests the rejection of SHA-1 certificates.
10 do_get_profile(); // must be called before getting nsIX509CertDB
11 const certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(
15 // (new Date("2016-03-01")).getTime() / 1000
16 const VALIDATION_TIME = 1456790400;
18 function certFromFile(certName) {
19 return constructCertFromFile("test_cert_sha1/" + certName + ".pem");
22 function loadCertWithTrust(certName, trustString) {
23 addCertFromFile(certdb, "test_cert_sha1/" + certName + ".pem", trustString);
26 function checkEndEntity(cert, expectedResult) {
27 return checkCertErrorGenericAtTime(
31 certificateUsageSSLServer,
36 add_task(async function () {
37 loadCertWithTrust("ca", "CTu,,");
38 loadCertWithTrust("int-pre", ",,");
39 loadCertWithTrust("int-post", ",,");
42 certFromFile("ee-pre_int-pre"),
43 SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED
46 certFromFile("ee-post_int-pre"),
47 SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED
50 certFromFile("ee-post_int-post"),
51 SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED