OLD | NEW |
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 <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 #endif | 225 #endif |
226 | 226 |
227 } // namespace | 227 } // namespace |
228 | 228 |
229 bool X509Certificate::LessThan::operator()(X509Certificate* lhs, | 229 bool X509Certificate::LessThan::operator()(X509Certificate* lhs, |
230 X509Certificate* rhs) const { | 230 X509Certificate* rhs) const { |
231 if (lhs == rhs) | 231 if (lhs == rhs) |
232 return false; | 232 return false; |
233 | 233 |
234 SHA1FingerprintLessThan fingerprint_functor; | 234 SHA1FingerprintLessThan fingerprint_functor; |
235 return fingerprint_functor(lhs->fingerprint_, rhs->fingerprint_); | 235 return fingerprint_functor(lhs->chain_fingerprint_, rhs->chain_fingerprint_); |
236 } | 236 } |
237 | 237 |
238 X509Certificate::X509Certificate(const std::string& subject, | 238 X509Certificate::X509Certificate(const std::string& subject, |
239 const std::string& issuer, | 239 const std::string& issuer, |
240 base::Time start_date, | 240 base::Time start_date, |
241 base::Time expiration_date) | 241 base::Time expiration_date) |
242 : subject_(subject), | 242 : subject_(subject), |
243 issuer_(issuer), | 243 issuer_(issuer), |
244 valid_start_(start_date), | 244 valid_start_(start_date), |
245 valid_expiry_(expiration_date), | 245 valid_expiry_(expiration_date), |
246 cert_handle_(NULL) { | 246 cert_handle_(NULL) { |
247 memset(fingerprint_.data, 0, sizeof(fingerprint_.data)); | 247 memset(fingerprint_.data, 0, sizeof(fingerprint_.data)); |
| 248 memset(chain_fingerprint_.data, 0, sizeof(chain_fingerprint_.data)); |
248 } | 249 } |
249 | 250 |
250 // static | 251 // static |
251 X509Certificate* X509Certificate::CreateFromHandle( | 252 X509Certificate* X509Certificate::CreateFromHandle( |
252 OSCertHandle cert_handle, | 253 OSCertHandle cert_handle, |
253 const OSCertHandles& intermediates) { | 254 const OSCertHandles& intermediates) { |
254 DCHECK(cert_handle); | 255 DCHECK(cert_handle); |
255 return new X509Certificate(cert_handle, intermediates); | 256 return new X509Certificate(cert_handle, intermediates); |
256 } | 257 } |
257 | 258 |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, | 1025 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, |
1025 const uint8* array, | 1026 const uint8* array, |
1026 size_t array_byte_len) { | 1027 size_t array_byte_len) { |
1027 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); | 1028 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); |
1028 const size_t arraylen = array_byte_len / base::kSHA1Length; | 1029 const size_t arraylen = array_byte_len / base::kSHA1Length; |
1029 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, | 1030 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, |
1030 CompareSHA1Hashes); | 1031 CompareSHA1Hashes); |
1031 } | 1032 } |
1032 | 1033 |
1033 } // namespace net | 1034 } // namespace net |
OLD | NEW |