| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 arraysize(kComodoSerials) + 1); | 209 arraysize(kComodoSerials) + 1); |
| 210 return true; | 210 return true; |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 // static | 218 // static |
| 219 // NOTE: This implementation assumes and enforces that the hashes are SHA1. |
| 219 bool CertVerifyProc::IsPublicKeyBlacklisted( | 220 bool CertVerifyProc::IsPublicKeyBlacklisted( |
| 220 const std::vector<SHA1Fingerprint>& public_key_hashes) { | 221 const HashValueVector& public_key_hashes) { |
| 221 static const unsigned kNumHashes = 9; | 222 static const unsigned kNumHashes = 9; |
| 222 static const uint8 kHashes[kNumHashes][base::kSHA1Length] = { | 223 static const uint8 kHashes[kNumHashes][base::kSHA1Length] = { |
| 223 // Subject: CN=DigiNotar Root CA | 224 // Subject: CN=DigiNotar Root CA |
| 224 // Issuer: CN=Entrust.net x2 and self-signed | 225 // Issuer: CN=Entrust.net x2 and self-signed |
| 225 {0x41, 0x0f, 0x36, 0x36, 0x32, 0x58, 0xf3, 0x0b, 0x34, 0x7d, | 226 {0x41, 0x0f, 0x36, 0x36, 0x32, 0x58, 0xf3, 0x0b, 0x34, 0x7d, |
| 226 0x12, 0xce, 0x48, 0x63, 0xe4, 0x33, 0x43, 0x78, 0x06, 0xa8}, | 227 0x12, 0xce, 0x48, 0x63, 0xe4, 0x33, 0x43, 0x78, 0x06, 0xa8}, |
| 227 // Subject: CN=DigiNotar Cyber CA | 228 // Subject: CN=DigiNotar Cyber CA |
| 228 // Issuer: CN=GTE CyberTrust Global Root | 229 // Issuer: CN=GTE CyberTrust Global Root |
| 229 {0xc4, 0xf9, 0x66, 0x37, 0x16, 0xcd, 0x5e, 0x71, 0xd6, 0x95, | 230 {0xc4, 0xf9, 0x66, 0x37, 0x16, 0xcd, 0x5e, 0x71, 0xd6, 0x95, |
| 230 0x0b, 0x5f, 0x33, 0xce, 0x04, 0x1c, 0x95, 0xb4, 0x35, 0xd1}, | 231 0x0b, 0x5f, 0x33, 0xce, 0x04, 0x1c, 0x95, 0xb4, 0x35, 0xd1}, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 256 {0xe1, 0x2d, 0x89, 0xf5, 0x6d, 0x22, 0x76, 0xf8, 0x30, 0xe6, | 257 {0xe1, 0x2d, 0x89, 0xf5, 0x6d, 0x22, 0x76, 0xf8, 0x30, 0xe6, |
| 257 0xce, 0xaf, 0xa6, 0x6c, 0x72, 0x5c, 0x0b, 0x41, 0xa9, 0x32}, | 258 0xce, 0xaf, 0xa6, 0x6c, 0x72, 0x5c, 0x0b, 0x41, 0xa9, 0x32}, |
| 258 // Cyberoam CA certificate. Private key leaked, but this certificate would | 259 // Cyberoam CA certificate. Private key leaked, but this certificate would |
| 259 // only have been installed by Cyberoam customers. The certificate expires | 260 // only have been installed by Cyberoam customers. The certificate expires |
| 260 // in 2036, but we can probably remove in a couple of years (2014). | 261 // in 2036, but we can probably remove in a couple of years (2014). |
| 261 {0xd9, 0xf5, 0xc6, 0xce, 0x57, 0xff, 0xaa, 0x39, 0xcc, 0x7e, | 262 {0xd9, 0xf5, 0xc6, 0xce, 0x57, 0xff, 0xaa, 0x39, 0xcc, 0x7e, |
| 262 0xd1, 0x72, 0xbd, 0x53, 0xe0, 0xd3, 0x07, 0x83, 0x4b, 0xd1}, | 263 0xd1, 0x72, 0xbd, 0x53, 0xe0, 0xd3, 0x07, 0x83, 0x4b, 0xd1}, |
| 263 }; | 264 }; |
| 264 | 265 |
| 265 for (unsigned i = 0; i < kNumHashes; i++) { | 266 for (unsigned i = 0; i < kNumHashes; i++) { |
| 266 for (std::vector<SHA1Fingerprint>::const_iterator | 267 for (HashValueVector::const_iterator j = public_key_hashes.begin(); |
| 267 j = public_key_hashes.begin(); j != public_key_hashes.end(); ++j) { | 268 j != public_key_hashes.end(); ++j) { |
| 268 if (memcmp(j->data, kHashes[i], base::kSHA1Length) == 0) | 269 if (j->tag == HASH_VALUE_SHA1 && |
| 270 memcmp(j->data(), kHashes[i], base::kSHA1Length) == 0) { |
| 269 return true; | 271 return true; |
| 272 } |
| 270 } | 273 } |
| 271 } | 274 } |
| 272 | 275 |
| 273 return false; | 276 return false; |
| 274 } | 277 } |
| 275 | 278 |
| 276 } // namespace net | 279 } // namespace net |
| OLD | NEW |