tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_nsIX509CertValidity.js (730B)


      1 // -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
      2 // Any copyright is dedicated to the Public Domain.
      3 // http://creativecommons.org/publicdomain/zero/1.0/
      4 "use strict";
      5 
      6 // This file tests the nsIX509CertValidity implementation.
      7 
      8 function run_test() {
      9  // Date.parse("2013-01-01T00:00:00Z")
     10  const NOT_BEFORE_IN_MS = 1356998400000;
     11  // Date.parse("2014-01-01T00:00:00Z")
     12  const NOT_AFTER_IN_MS = 1388534400000;
     13  let cert = constructCertFromFile("bad_certs/expired-ee.pem");
     14 
     15  equal(
     16    cert.validity.notBefore,
     17    NOT_BEFORE_IN_MS * 1000,
     18    "Actual and expected notBefore should be equal"
     19  );
     20  equal(
     21    cert.validity.notAfter,
     22    NOT_AFTER_IN_MS * 1000,
     23    "Actual and expected notAfter should be equal"
     24  );
     25 }