OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/cert/cert_verify_proc_whitelist.h" | 5 #include "net/cert/cert_verify_proc_whitelist.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "net/base/test_data_directory.h" | 8 #include "net/base/test_data_directory.h" |
9 #include "net/cert/x509_certificate.h" | 9 #include "net/cert/x509_certificate.h" |
10 #include "net/test/cert_test_util.h" | 10 #include "net/test/cert_test_util.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 return public_key_hashes; | 36 return public_key_hashes; |
37 } | 37 } |
38 | 38 |
39 // The SHA-256 hash of the leaf cert "ok_cert.pem"; obtainable either | 39 // The SHA-256 hash of the leaf cert "ok_cert.pem"; obtainable either |
40 // via X509Certificate::CalculateFingerprint256 or | 40 // via X509Certificate::CalculateFingerprint256 or |
41 // openssl x509 -inform pem -in ok_cert.pem -outform der | openssl | 41 // openssl x509 -inform pem -in ok_cert.pem -outform der | openssl |
42 // dgst -sha256 -c | 42 // dgst -sha256 -c |
43 const uint8_t kWhitelistCerts[][crypto::kSHA256Length] = { | 43 const uint8_t kWhitelistCerts[][crypto::kSHA256Length] = { |
44 /* clang-format off */ | 44 /* clang-format off */ |
45 { 0xf4, 0x42, 0xdd, 0x66, 0xfa, 0x10, 0x70, 0x65, | 45 { 0x00, 0x0e, 0x04, 0x9f, 0x07, 0x2c, 0x30, 0xec, |
46 0xd1, 0x7e, 0xd9, 0xbb, 0x7c, 0xa9, 0x3c, 0x79, | 46 0xdc, 0xa0, 0x37, 0x5e, 0x2b, 0xf9, 0x87, 0x17, |
47 0x63, 0xbe, 0x01, 0xa7, 0x54, 0x18, 0xab, 0x2f, | 47 0x96, 0xaa, 0xbb, 0x1a, 0xd2, 0x23, 0x2a, 0x99, |
48 0xc3, 0x9a, 0x14, 0x53, 0xc3, 0x83, 0xa0, 0x5a }, | 48 0x08, 0x9e, 0x39, 0x50, 0xb5, 0x9f, 0x1b, 0x1e }, |
49 /* clang-format on */ | 49 /* clang-format on */ |
50 }; | 50 }; |
51 | 51 |
52 TEST(CertVerifyProcWhitelistTest, AcceptsWhitelistedEEByRoot) { | 52 TEST(CertVerifyProcWhitelistTest, AcceptsWhitelistedEEByRoot) { |
53 scoped_refptr<X509Certificate> cert = | 53 scoped_refptr<X509Certificate> cert = |
54 ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); | 54 ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); |
55 ASSERT_TRUE(cert); | 55 ASSERT_TRUE(cert); |
56 | 56 |
57 // clang-format off | 57 // clang-format off |
58 const PublicKeyWhitelist kWhitelist[] = { | 58 const PublicKeyWhitelist kWhitelist[] = { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Should return false, because the chain (as indicated by | 180 // Should return false, because the chain (as indicated by |
181 // public_key_hashes) is not constrained. | 181 // public_key_hashes) is not constrained. |
182 EXPECT_FALSE(IsNonWhitelistedCertificate(*cert, public_key_hashes)); | 182 EXPECT_FALSE(IsNonWhitelistedCertificate(*cert, public_key_hashes)); |
183 | 183 |
184 SetCertificateWhitelistForTesting(nullptr, 0); | 184 SetCertificateWhitelistForTesting(nullptr, 0); |
185 } | 185 } |
186 | 186 |
187 } // namespace | 187 } // namespace |
188 | 188 |
189 } // namespace net | 189 } // namespace net |
OLD | NEW |