|
|
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
|
+
|
|
|
5
|
+"use strict";
|
|
|
6
|
+
|
|
|
7
|
+// Checks that OneCRL loads its remote settings bundle at startup by ensuring
|
|
|
8
|
+// that each of the listed eMudhra intermediate certificates is revoked.
|
|
|
9
|
+
|
|
|
10
|
+do_get_profile();
|
|
|
11
|
+
|
|
|
12
|
+const { TestUtils } = ChromeUtils.importESModule(
|
|
|
13
|
+ "resource://testing-common/TestUtils.sys.mjs"
|
|
|
14
|
+);
|
|
|
15
|
+const { RemoteSecuritySettings } = ChromeUtils.importESModule(
|
|
|
16
|
+ "resource://gre/modules/psm/RemoteSecuritySettings.sys.mjs"
|
|
|
17
|
+);
|
|
|
18
|
+
|
|
|
19
|
+// DER encoding of the issuer name (CN=emSign Root TLS CA - G3), base64.
|
|
|
20
|
+const ISSUER =
|
|
|
21
|
+ "MFYxCzAJBgNVBAYTAklOMSUwIwYDVQQKDBxlTXVkaHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMSAwHgYDVQQDDBdlbVNpZ24gUm9vdCBUTFMgQ0EgLSBHMw==";
|
|
|
22
|
+
|
|
|
23
|
+// Serial numbers are the contents of the DER INTEGER, in hex.
|
|
|
24
|
+const SERIALS = {
|
|
|
25
|
+ "EM DV TLS CA - G3B": "00a4aee678f23362b4c0e460b772f214",
|
|
|
26
|
+ "EM OV TLS CA - G3B": "6cada367fb1c100088120ea202d568",
|
|
|
27
|
+ "EM EV TLS CA - G3B": "00c7c41efe92d825f05eae841a4a82c1",
|
|
|
28
|
+ "EM DV TLS CA - G3C": "588b2e3c2bb8cda13e1a1209254321",
|
|
|
29
|
+ "EM OV TLS CA - G3C": "296926c227a3a1526392b19482a504",
|
|
|
30
|
+ "EM EV TLS CA - G3C": "008009928a64107601af05fa2f19f109",
|
|
|
31
|
+};
|
|
|
32
|
+
|
|
|
33
|
+function base64ToBytes(base64) {
|
|
|
34
|
+ return Array.from(atob(base64), c => c.charCodeAt(0));
|
|
|
35
|
+}
|
|
|
36
|
+
|
|
|
37
|
+function hexToBytes(hex) {
|
|
|
38
|
+ return hex.match(/../g).map(byte => parseInt(byte, 16));
|
|
|
39
|
+}
|
|
|
40
|
+
|
|
|
41
|
+add_task(async function test_emsign_intermediates_are_revoked() {
|
|
|
42
|
+ let loaded = TestUtils.topicObserved(
|
|
|
43
|
+ "remote-security-settings:onecrl-bundle-loaded"
|
|
|
44
|
+ );
|
|
|
45
|
+ RemoteSecuritySettings.init();
|
|
|
46
|
+ await loaded;
|
|
|
47
|
+
|
|
|
48
|
+ let certStorage = Cc["@mozilla.org/security/certstorage;1"].getService(
|
|
|
49
|
+ Ci.nsICertStorage
|
|
|
50
|
+ );
|
|
|
51
|
+ let issuer = base64ToBytes(ISSUER);
|
|
|
52
|
+
|
|
|
53
|
+ for (let [name, serial] of Object.entries(SERIALS)) {
|
|
|
54
|
+ Assert.equal(
|
|
|
55
|
+ certStorage.getRevocationState(issuer, hexToBytes(serial), [], []),
|
|
|
56
|
+ Ci.nsICertStorage.STATE_ENFORCE,
|
|
|
57
|
+ `${name} should be revoked`
|
|
|
58
|
+ );
|
|
|
59
|
+ }
|
|
|
60
|
+}); |