Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: net/base/x509_certificate.cc

Issue 7792023: Merge 98741 to 782: Mark DigiNotar as untrusted (Closed) Base URL: svn://svn.chromium.org/chrome/branches/782/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/x509_certificate.h ('k') | net/base/x509_certificate_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 UMA_HISTOGRAM_ENUMERATION("Net.SSLCertBlacklisted", i, kNumSerials); 584 UMA_HISTOGRAM_ENUMERATION("Net.SSLCertBlacklisted", i, kNumSerials);
585 return true; 585 return true;
586 } 586 }
587 } 587 }
588 } 588 }
589 589
590 return false; 590 return false;
591 } 591 }
592 592
593 // static 593 // static
594 bool X509Certificate::IsPublicKeyBlacklisted(
595 const std::vector<SHA1Fingerprint>& public_key_hashes) {
596 static const unsigned kNumHashes = 1;
597 static const uint8 kHashes[kNumHashes][base::SHA1_LENGTH] = {
598 // CN=DigiNotar Root CA
599 {0x41, 0x0f, 0x36, 0x36, 0x32, 0x58, 0xf3, 0x0b, 0x34, 0x7d,
600 0x12, 0xce, 0x48, 0x63, 0xe4, 0x33, 0x43, 0x78, 0x06, 0xa8},
601 };
602
603 for (unsigned i = 0; i < kNumHashes; i++) {
604 for (std::vector<SHA1Fingerprint>::const_iterator
605 j = public_key_hashes.begin(); j != public_key_hashes.end(); ++j) {
606 if (memcmp(j->data, kHashes[i], base::SHA1_LENGTH) == 0)
607 return true;
608 }
609 }
610
611 return false;
612 }
613
614
615 // static
594 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, 616 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash,
595 const uint8* array, 617 const uint8* array,
596 size_t array_byte_len) { 618 size_t array_byte_len) {
597 DCHECK_EQ(0u, array_byte_len % base::SHA1_LENGTH); 619 DCHECK_EQ(0u, array_byte_len % base::SHA1_LENGTH);
598 const unsigned arraylen = array_byte_len / base::SHA1_LENGTH; 620 const unsigned arraylen = array_byte_len / base::SHA1_LENGTH;
599 return NULL != bsearch(hash.data, array, arraylen, base::SHA1_LENGTH, 621 return NULL != bsearch(hash.data, array, arraylen, base::SHA1_LENGTH,
600 CompareSHA1Hashes); 622 CompareSHA1Hashes);
601 } 623 }
602 624
603 } // namespace net 625 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_certificate.h ('k') | net/base/x509_certificate_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698