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

Side by Side Diff: chrome/common/net/x509_certificate_model_nss.cc

Issue 10391197: If the version field is omitted from the certificate, the default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | « no previous file | no next file » | 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 "chrome/common/net/x509_certificate_model.h" 5 #include "chrome/common/net/x509_certificate_model.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <cms.h> 8 #include <cms.h>
9 #include <hasht.h> 9 #include <hasht.h>
10 #include <keyhi.h> // SECKEY_DestroyPrivateKey 10 #include <keyhi.h> // SECKEY_DestroyPrivateKey
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 name = name.substr(colon_pos + 1); 118 name = name.substr(colon_pos + 1);
119 } 119 }
120 return name; 120 return name;
121 } 121 }
122 122
123 string GetTokenName(X509Certificate::OSCertHandle cert_handle) { 123 string GetTokenName(X509Certificate::OSCertHandle cert_handle) {
124 return psm::GetCertTokenName(cert_handle); 124 return psm::GetCertTokenName(cert_handle);
125 } 125 }
126 126
127 string GetVersion(X509Certificate::OSCertHandle cert_handle) { 127 string GetVersion(X509Certificate::OSCertHandle cert_handle) {
128 unsigned long version = ULONG_MAX; 128 // If the version field is omitted from the certificate, the default
129 if (SEC_ASN1DecodeInteger(&cert_handle->version, &version) == SECSuccess && 129 // value is v1(0).
130 version != ULONG_MAX) 130 unsigned long version = 0;
wtc 2012/05/18 01:15:57 I guess the version != ULONG_MAX check here is to
mattm 2012/05/18 03:19:50 Honestly I can't remember why it's that way, but t
wtc 2012/05/18 21:47:13 In my testing with several recent versions of NSS,
131 if (cert_handle->version.len == 0 ||
132 SEC_ASN1DecodeInteger(&cert_handle->version, &version) == SECSuccess) {
131 return base::UintToString(version + 1); 133 return base::UintToString(version + 1);
134 }
132 return ""; 135 return "";
133 } 136 }
134 137
135 net::CertType GetType(X509Certificate::OSCertHandle cert_handle) { 138 net::CertType GetType(X509Certificate::OSCertHandle cert_handle) {
136 return psm::GetCertType(cert_handle); 139 return psm::GetCertType(cert_handle);
137 } 140 }
138 141
139 string GetEmailAddress(X509Certificate::OSCertHandle cert_handle) { 142 string GetEmailAddress(X509Certificate::OSCertHandle cert_handle) {
140 if (cert_handle->emailAddr) 143 if (cert_handle->emailAddr)
141 return cert_handle->emailAddr; 144 return cert_handle->emailAddr;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) { 407 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) {
405 return ProcessRawBits(cert_handle->signatureWrap.signature.data, 408 return ProcessRawBits(cert_handle->signatureWrap.signature.data,
406 cert_handle->signatureWrap.signature.len); 409 cert_handle->signatureWrap.signature.len);
407 } 410 }
408 411
409 void RegisterDynamicOids() { 412 void RegisterDynamicOids() {
410 psm::RegisterDynamicOids(); 413 psm::RegisterDynamicOids();
411 } 414 }
412 415
413 } // namespace x509_certificate_model 416 } // namespace x509_certificate_model
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698