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

Side by Side Diff: net/cert/x509_certificate_win.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/cert/x509_util_nss_certs.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) 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 unsigned int result_len; 366 unsigned int result_len;
367 SHA1_End(sha1_ctx, sha1.data, &result_len, SHA1_LENGTH); 367 SHA1_End(sha1_ctx, sha1.data, &result_len, SHA1_LENGTH);
368 SHA1_DestroyContext(sha1_ctx, PR_TRUE); 368 SHA1_DestroyContext(sha1_ctx, PR_TRUE);
369 #endif // USE_OPENSSL 369 #endif // USE_OPENSSL
370 370
371 return sha1; 371 return sha1;
372 } 372 }
373 373
374 // static 374 // static
375 X509Certificate::OSCertHandle 375 X509Certificate::OSCertHandle X509Certificate::ReadOSCertHandleFromPickle(
376 X509Certificate::ReadOSCertHandleFromPickle(PickleIterator* pickle_iter) { 376 base::PickleIterator* pickle_iter) {
377 const char* data; 377 const char* data;
378 int length; 378 int length;
379 if (!pickle_iter->ReadData(&data, &length)) 379 if (!pickle_iter->ReadData(&data, &length))
380 return NULL; 380 return NULL;
381 381
382 // Legacy serialized certificates were serialized with extended attributes, 382 // Legacy serialized certificates were serialized with extended attributes,
383 // rather than as DER only. As a result, these serialized certificates are 383 // rather than as DER only. As a result, these serialized certificates are
384 // not portable across platforms and may have side-effects on Windows due 384 // not portable across platforms and may have side-effects on Windows due
385 // to extended attributes being serialized/deserialized - 385 // to extended attributes being serialized/deserialized -
386 // http://crbug.com/118706. To avoid deserializing these attributes, write 386 // http://crbug.com/118706. To avoid deserializing these attributes, write
(...skipping 17 matching lines...) Expand all
404 FreeOSCertHandle(cert_handle); 404 FreeOSCertHandle(cert_handle);
405 cert_handle = NULL; 405 cert_handle = NULL;
406 406
407 if (ok) 407 if (ok)
408 cert_handle = CreateOSCertHandleFromBytes(encoded.data(), encoded.size()); 408 cert_handle = CreateOSCertHandleFromBytes(encoded.data(), encoded.size());
409 return cert_handle; 409 return cert_handle;
410 } 410 }
411 411
412 // static 412 // static
413 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle, 413 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle,
414 Pickle* pickle) { 414 base::Pickle* pickle) {
415 return pickle->WriteData( 415 return pickle->WriteData(
416 reinterpret_cast<char*>(cert_handle->pbCertEncoded), 416 reinterpret_cast<char*>(cert_handle->pbCertEncoded),
417 cert_handle->cbCertEncoded); 417 cert_handle->cbCertEncoded);
418 } 418 }
419 419
420 // static 420 // static
421 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, 421 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle,
422 size_t* size_bits, 422 size_t* size_bits,
423 PublicKeyType* type) { 423 PublicKeyType* type) {
424 *type = kPublicKeyTypeUnknown; 424 *type = kPublicKeyTypeUnknown;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 X509_ASN_ENCODING, 492 X509_ASN_ENCODING,
493 CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, 493 CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT,
494 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), 494 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)),
495 CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, 495 CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT,
496 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), 496 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)),
497 0, 497 0,
498 NULL); 498 NULL);
499 } 499 }
500 500
501 } // namespace net 501 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/cert/x509_util_nss_certs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698