mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1695332 - Update test_cert_isBuiltInRoot/isBuiltInRoot_reload.js r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D106719
This commit is contained in:
parent
0a067869c7
commit
f153ff93e4
@ -14,23 +14,39 @@ const certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(
|
||||
|
||||
// This is a certificate that (currently) ships with the platform.
|
||||
// It should be considered a built-in root.
|
||||
const sGeoTrustBase64 =
|
||||
const sNaverBase64 =
|
||||
"" +
|
||||
"MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL" +
|
||||
"MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj" +
|
||||
"KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2" +
|
||||
"MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0" +
|
||||
"eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV" +
|
||||
"BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw" +
|
||||
"NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV" +
|
||||
"BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH" +
|
||||
"MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL" +
|
||||
"So17VDs6bl8VAsBQps8lL33KSLjHUGMcKiEIfJo22Av+0SbFWDEwKCXzXV2juLal" +
|
||||
"tJLtbCyf691DiaI8S0iRHVDsJt/WY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vq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8" +
|
||||
"piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR" +
|
||||
"LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX" +
|
||||
"5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO" +
|
||||
"dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul" +
|
||||
"9XXeifdy";
|
||||
|
||||
// This is a certificate that does not ship with the platform.
|
||||
// It should not be considered a built-in root.
|
||||
@ -63,7 +79,7 @@ const sLetsEncryptBase64 =
|
||||
"f1w8DdnkabOLGeOVcj9LQ+s67vBykx4anTjURkbqZslUEUsn2k5xeua2zUk=";
|
||||
|
||||
function run_test() {
|
||||
let builtInCert = certdb.constructX509FromBase64(sGeoTrustBase64);
|
||||
let builtInCert = certdb.constructX509FromBase64(sNaverBase64);
|
||||
ok(builtInCert, "should be able to decode base-64 of built-in cert");
|
||||
ok(builtInCert.isBuiltInRoot, "cert should be considered built-in");
|
||||
|
||||
|
@ -7,40 +7,60 @@
|
||||
// test_cert_isBuiltInRoot.js in that this test uses a preexisting NSS
|
||||
// certificate DB that already contains some of the certificates in question.
|
||||
//
|
||||
// To create the necessary preexisting files, obtain the "GeoTrust Primary
|
||||
// Certification Authority - G2" certificate and the "Let's Encrypt Authority
|
||||
// To create the necessary preexisting files, obtain the "NAVER Global Root
|
||||
// Certification Authority" certificate and the "Let's Encrypt Authority
|
||||
// X1" certificate (copied below for reference) and perform the following steps:
|
||||
//
|
||||
// `certutil -d . -N` (use an empty password)
|
||||
// `certutil -d . -A -n "GeoTrust Primary Certification Authority - G2" -t ,, \
|
||||
// -a -i GeoTrust.pem`
|
||||
// `certutil -d . -A -n "NAVER Global Root Certification Authority" -t ,, \
|
||||
// -a -i naverrc1.pem`
|
||||
// `certutil -d . -A -n "Let's Encrypt Authority X1" -t ,, -a \
|
||||
// -i LetsEncrypt.pem`
|
||||
//
|
||||
// This should create the cert9.db and key4.db files.
|
||||
//
|
||||
// To determine the new DBKey associated to the replacement root,
|
||||
// one can print builtInRoot.dbKey in test_cert_isBuiltInRoot.js.
|
||||
//
|
||||
// (The crucial property of the first certificate is that it is a built-in trust
|
||||
// anchor, so any replacement must also have this property. The second
|
||||
// certificate is not a built-in trust anchor, so any replacement must not be a
|
||||
// built-in trust anchor.)
|
||||
//
|
||||
// GeoTrust Primary Certification Authority - G2:
|
||||
//
|
||||
// NAVER Global Root Certification Authority:
|
||||
// -----BEGIN CERTIFICATE-----
|
||||
// MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL
|
||||
// MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj
|
||||
// KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2
|
||||
// MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
|
||||
// eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV
|
||||
// BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw
|
||||
// NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV
|
||||
// BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH
|
||||
// MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL
|
||||
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GBs32x9SuRwTMKeuB330DTHD8z7
|
||||
// p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8
|
||||
// piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR
|
||||
// LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX
|
||||
// 5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO
|
||||
// dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul
|
||||
// 9XXeifdy
|
||||
// -----END CERTIFICATE-----
|
||||
//
|
||||
// Let's Encrypt Authority X1:
|
||||
@ -104,14 +124,13 @@ function run_test() {
|
||||
|
||||
// This is a built-in root. It was added to the preexisting certificate DB. It
|
||||
// should still be considered a built-in.
|
||||
const geoTrustCertDBKey = `AAAAAAAAAAAAAAAQAAAAmzyy9EgK
|
||||
AOL+6yQ7XmA+w2swgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJ
|
||||
bmMuMTkwNwYDVQQLEzAoYykgMjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhv
|
||||
cml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlm
|
||||
aWNhdGlvbiBBdXRob3JpdHkgLSBHMg==`;
|
||||
let geoTrustCert = certdb.findCertByDBKey(geoTrustCertDBKey);
|
||||
ok(geoTrustCert, "Should be able to find GeoTrust root");
|
||||
ok(geoTrustCert.isBuiltInRoot, "GeoTrust root is a built-in");
|
||||
const naverCertDBKey = `AAAAAAAAAAAAAAAUAAAAawGUMB6iC93
|
||||
1xTMqsUNEcfjWUE0NMGkxCzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVN
|
||||
JTkVTUyBQTEFURk9STSBDb3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3Q
|
||||
gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHk=`;
|
||||
let naverCert = certdb.findCertByDBKey(naverCertDBKey);
|
||||
ok(naverCert, "Should be able to find NAVER root");
|
||||
ok(naverCert.isBuiltInRoot, "NAVER root is a built-in");
|
||||
|
||||
// This is not a built-in root. It was added to the preexisting certificate
|
||||
// DB. It should not be considered a built-in root.
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user