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

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

Issue 452042: Define X509Certificate::intermediate_ca_certs_ as a std::vector of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Update retain the result comment. Sync to ToT. Created 11 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
« no previous file with comments | « net/base/x509_certificate.h ('k') | net/base/x509_certificate_mac.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/histogram.h" 7 #include "base/histogram.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int length) { 163 int length) {
164 OSCertHandle cert_handle = CreateOSCertHandleFromBytes(data, length); 164 OSCertHandle cert_handle = CreateOSCertHandleFromBytes(data, length);
165 if (!cert_handle) 165 if (!cert_handle)
166 return NULL; 166 return NULL;
167 167
168 return CreateFromHandle(cert_handle, SOURCE_LONE_CERT_IMPORT); 168 return CreateFromHandle(cert_handle, SOURCE_LONE_CERT_IMPORT);
169 } 169 }
170 170
171 X509Certificate::X509Certificate(OSCertHandle cert_handle, Source source) 171 X509Certificate::X509Certificate(OSCertHandle cert_handle, Source source)
172 : cert_handle_(cert_handle), 172 : cert_handle_(cert_handle),
173 #if defined(OS_MACOSX)
174 intermediate_ca_certs_(NULL),
175 #endif
176 source_(source) { 173 source_(source) {
177 Initialize(); 174 Initialize();
178 } 175 }
179 176
180 X509Certificate::X509Certificate(const std::string& subject, 177 X509Certificate::X509Certificate(const std::string& subject,
181 const std::string& issuer, 178 const std::string& issuer,
182 base::Time start_date, 179 base::Time start_date,
183 base::Time expiration_date) 180 base::Time expiration_date)
184 : subject_(subject), 181 : subject_(subject),
185 issuer_(issuer), 182 issuer_(issuer),
186 valid_start_(start_date), 183 valid_start_(start_date),
187 valid_expiry_(expiration_date), 184 valid_expiry_(expiration_date),
188 cert_handle_(NULL), 185 cert_handle_(NULL),
189 #if defined(OS_MACOSX)
190 intermediate_ca_certs_(NULL),
191 #endif
192 source_(SOURCE_UNUSED) { 186 source_(SOURCE_UNUSED) {
193 memset(fingerprint_.data, 0, sizeof(fingerprint_.data)); 187 memset(fingerprint_.data, 0, sizeof(fingerprint_.data));
194 } 188 }
195 189
196 X509Certificate::~X509Certificate() { 190 X509Certificate::~X509Certificate() {
197 // We might not be in the cache, but it is safe to remove ourselves anyway. 191 // We might not be in the cache, but it is safe to remove ourselves anyway.
198 X509Certificate::Cache::GetInstance()->Remove(this); 192 X509Certificate::Cache::GetInstance()->Remove(this);
199 if (cert_handle_) 193 if (cert_handle_)
200 FreeOSCertHandle(cert_handle_); 194 FreeOSCertHandle(cert_handle_);
201 #if defined(OS_MACOSX) 195 #if defined(OS_MACOSX) || defined(OS_WIN)
202 if (intermediate_ca_certs_) 196 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i)
203 CFRelease(intermediate_ca_certs_); 197 FreeOSCertHandle(intermediate_ca_certs_[i]);
204 #endif 198 #endif
205 } 199 }
206 200
207 bool X509Certificate::HasExpired() const { 201 bool X509Certificate::HasExpired() const {
208 return base::Time::Now() > valid_expiry(); 202 return base::Time::Now() > valid_expiry();
209 } 203 }
210 204
211 } // namespace net 205 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_certificate.h ('k') | net/base/x509_certificate_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698