OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/cert_verify_proc.h" | 5 #include "net/base/cert_verify_proc.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "net/base/cert_status_flags.h" | 10 #include "net/base/cert_status_flags.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 arraysize(kComodoSerials) + 1); | 210 arraysize(kComodoSerials) + 1); |
211 return true; | 211 return true; |
212 } | 212 } |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 return false; | 216 return false; |
217 } | 217 } |
218 | 218 |
219 // static | 219 // static |
| 220 // NOTE: This implementation assumes and enforces that the hashes are SHA1. |
220 bool CertVerifyProc::IsPublicKeyBlacklisted( | 221 bool CertVerifyProc::IsPublicKeyBlacklisted( |
221 const std::vector<SHA1Fingerprint>& public_key_hashes) { | 222 const std::vector<Fingerprint>& public_key_hashes) { |
222 static const unsigned kNumHashes = 8; | 223 static const unsigned kNumHashes = 8; |
223 static const uint8 kHashes[kNumHashes][base::kSHA1Length] = { | 224 static const uint8 kHashes[kNumHashes][base::kSHA1Length] = { |
224 // Subject: CN=DigiNotar Root CA | 225 // Subject: CN=DigiNotar Root CA |
225 // Issuer: CN=Entrust.net x2 and self-signed | 226 // Issuer: CN=Entrust.net x2 and self-signed |
226 {0x41, 0x0f, 0x36, 0x36, 0x32, 0x58, 0xf3, 0x0b, 0x34, 0x7d, | 227 {0x41, 0x0f, 0x36, 0x36, 0x32, 0x58, 0xf3, 0x0b, 0x34, 0x7d, |
227 0x12, 0xce, 0x48, 0x63, 0xe4, 0x33, 0x43, 0x78, 0x06, 0xa8}, | 228 0x12, 0xce, 0x48, 0x63, 0xe4, 0x33, 0x43, 0x78, 0x06, 0xa8}, |
228 // Subject: CN=DigiNotar Cyber CA | 229 // Subject: CN=DigiNotar Cyber CA |
229 // Issuer: CN=GTE CyberTrust Global Root | 230 // Issuer: CN=GTE CyberTrust Global Root |
230 {0xc4, 0xf9, 0x66, 0x37, 0x16, 0xcd, 0x5e, 0x71, 0xd6, 0x95, | 231 {0xc4, 0xf9, 0x66, 0x37, 0x16, 0xcd, 0x5e, 0x71, 0xd6, 0x95, |
231 0x0b, 0x5f, 0x33, 0xce, 0x04, 0x1c, 0x95, 0xb4, 0x35, 0xd1}, | 232 0x0b, 0x5f, 0x33, 0xce, 0x04, 0x1c, 0x95, 0xb4, 0x35, 0xd1}, |
(...skipping 20 matching lines...) Expand all Loading... |
252 {0xd3, 0x3c, 0x5b, 0x41, 0xe4, 0x5c, 0xc4, 0xb3, 0xbe, 0x9a, | 253 {0xd3, 0x3c, 0x5b, 0x41, 0xe4, 0x5c, 0xc4, 0xb3, 0xbe, 0x9a, |
253 0xd6, 0x95, 0x2c, 0x4e, 0xcc, 0x25, 0x28, 0x03, 0x29, 0x81}, | 254 0xd6, 0x95, 0x2c, 0x4e, 0xcc, 0x25, 0x28, 0x03, 0x29, 0x81}, |
254 // Issuer: CN=Trustwave Organization Issuing CA, Level 2 | 255 // Issuer: CN=Trustwave Organization Issuing CA, Level 2 |
255 // Covers two certificates, the latter of which expires Apr 15 21:09:30 | 256 // Covers two certificates, the latter of which expires Apr 15 21:09:30 |
256 // 2021 GMT. | 257 // 2021 GMT. |
257 {0xe1, 0x2d, 0x89, 0xf5, 0x6d, 0x22, 0x76, 0xf8, 0x30, 0xe6, | 258 {0xe1, 0x2d, 0x89, 0xf5, 0x6d, 0x22, 0x76, 0xf8, 0x30, 0xe6, |
258 0xce, 0xaf, 0xa6, 0x6c, 0x72, 0x5c, 0x0b, 0x41, 0xa9, 0x32}, | 259 0xce, 0xaf, 0xa6, 0x6c, 0x72, 0x5c, 0x0b, 0x41, 0xa9, 0x32}, |
259 }; | 260 }; |
260 | 261 |
261 for (unsigned i = 0; i < kNumHashes; i++) { | 262 for (unsigned i = 0; i < kNumHashes; i++) { |
262 for (std::vector<SHA1Fingerprint>::const_iterator | 263 for (std::vector<Fingerprint>::const_iterator |
263 j = public_key_hashes.begin(); j != public_key_hashes.end(); ++j) { | 264 j = public_key_hashes.begin(); j != public_key_hashes.end(); ++j) { |
264 if (memcmp(j->data, kHashes[i], base::kSHA1Length) == 0) | 265 if (j->tag == FINGERPRINT_SHA1 && |
| 266 memcmp(j->data(), kHashes[i], base::kSHA1Length) == 0) { |
265 return true; | 267 return true; |
| 268 } |
266 } | 269 } |
267 } | 270 } |
268 | 271 |
269 return false; | 272 return false; |
270 } | 273 } |
271 | 274 |
272 } // namespace net | 275 } // namespace net |
OLD | NEW |