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/cert/x509_certificate.h" | 5 #include "net/cert/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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 OSCertHandle cert_handle = CreateOSCertHandleFromBytes(data, length); | 299 OSCertHandle cert_handle = CreateOSCertHandleFromBytes(data, length); |
300 if (!cert_handle) | 300 if (!cert_handle) |
301 return NULL; | 301 return NULL; |
302 | 302 |
303 X509Certificate* cert = CreateFromHandle(cert_handle, OSCertHandles()); | 303 X509Certificate* cert = CreateFromHandle(cert_handle, OSCertHandles()); |
304 FreeOSCertHandle(cert_handle); | 304 FreeOSCertHandle(cert_handle); |
305 return cert; | 305 return cert; |
306 } | 306 } |
307 | 307 |
308 // static | 308 // static |
309 X509Certificate* X509Certificate::CreateFromPickle(PickleIterator* pickle_iter, | 309 X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle, |
| 310 PickleIterator* pickle_iter, |
310 PickleType type) { | 311 PickleType type) { |
311 if (type == PICKLETYPE_CERTIFICATE_CHAIN_V3) { | 312 if (type == PICKLETYPE_CERTIFICATE_CHAIN_V3) { |
312 int chain_length = 0; | 313 int chain_length = 0; |
313 if (!pickle_iter->ReadLength(&chain_length)) | 314 if (!pickle_iter->ReadLength(&chain_length)) |
314 return NULL; | 315 return NULL; |
315 | 316 |
316 std::vector<base::StringPiece> cert_chain; | 317 std::vector<base::StringPiece> cert_chain; |
317 const char* data = NULL; | 318 const char* data = NULL; |
318 int data_length = 0; | 319 int data_length = 0; |
319 for (int i = 0; i < chain_length; ++i) { | 320 for (int i = 0; i < chain_length; ++i) { |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 RemoveFromCache(cert_handle_); | 751 RemoveFromCache(cert_handle_); |
751 FreeOSCertHandle(cert_handle_); | 752 FreeOSCertHandle(cert_handle_); |
752 } | 753 } |
753 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { | 754 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { |
754 RemoveFromCache(intermediate_ca_certs_[i]); | 755 RemoveFromCache(intermediate_ca_certs_[i]); |
755 FreeOSCertHandle(intermediate_ca_certs_[i]); | 756 FreeOSCertHandle(intermediate_ca_certs_[i]); |
756 } | 757 } |
757 } | 758 } |
758 | 759 |
759 } // namespace net | 760 } // namespace net |
OLD | NEW |