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

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

Issue 8566056: This applies GUIDs to certificate and key nicknames when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review edits Created 9 years 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
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 <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 int length) { 298 int length) {
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 #if defined(USE_NSS)
309 // static
310 X509Certificate* X509Certificate::CreateFromBytesWithNickname(
wtc 2011/11/29 23:13:57 This probably should be moved to x509_certificate_
Greg Spencer (Chromium) 2011/12/02 18:50:07 Ahh, good point. I moved it there.
311 const char* data,
312 int length,
313 const char* nickname) {
314 OSCertHandle cert_handle = CreateOSCertHandleFromBytesWithNickname(data,
315 length,
316 nickname);
317 if (!cert_handle)
318 return NULL;
319
320 X509Certificate* cert = CreateFromHandle(cert_handle, OSCertHandles());
321 FreeOSCertHandle(cert_handle);
322 return cert;
323 }
324 #endif
325
308 // static 326 // static
309 X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle, 327 X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle,
310 void** pickle_iter, 328 void** pickle_iter,
311 PickleType type) { 329 PickleType type) {
312 OSCertHandle cert_handle = ReadOSCertHandleFromPickle(pickle, pickle_iter); 330 OSCertHandle cert_handle = ReadOSCertHandleFromPickle(pickle, pickle_iter);
313 if (!cert_handle) 331 if (!cert_handle)
314 return NULL; 332 return NULL;
315 333
316 OSCertHandles intermediates; 334 OSCertHandles intermediates;
317 size_t num_intermediates = 0; 335 size_t num_intermediates = 0;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, 816 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash,
799 const uint8* array, 817 const uint8* array,
800 size_t array_byte_len) { 818 size_t array_byte_len) {
801 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); 819 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length);
802 const size_t arraylen = array_byte_len / base::kSHA1Length; 820 const size_t arraylen = array_byte_len / base::kSHA1Length;
803 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, 821 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length,
804 CompareSHA1Hashes); 822 CompareSHA1Hashes);
805 } 823 }
806 824
807 } // namespace net 825 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698