OLD | NEW |
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 #ifndef NET_BASE_X509_CERTIFICATE_H_ | 5 #ifndef NET_BASE_X509_CERTIFICATE_H_ |
6 #define NET_BASE_X509_CERTIFICATE_H_ | 6 #define NET_BASE_X509_CERTIFICATE_H_ |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // EV certificate verification is performed. | 203 // EV certificate verification is performed. |
204 int Verify(const std::string& hostname, | 204 int Verify(const std::string& hostname, |
205 int flags, | 205 int flags, |
206 CertVerifyResult* verify_result) const; | 206 CertVerifyResult* verify_result) const; |
207 | 207 |
208 OSCertHandle os_cert_handle() const { return cert_handle_; } | 208 OSCertHandle os_cert_handle() const { return cert_handle_; } |
209 | 209 |
210 // Returns true if two OSCertHandles refer to identical certificates. | 210 // Returns true if two OSCertHandles refer to identical certificates. |
211 static bool IsSameOSCert(OSCertHandle a, OSCertHandle b); | 211 static bool IsSameOSCert(OSCertHandle a, OSCertHandle b); |
212 | 212 |
| 213 // Creates an OS certificate handle from the BER-encoded representation. |
| 214 // Returns NULL on failure. |
| 215 static OSCertHandle CreateOSCertHandleFromBytes(const char* data, |
| 216 int length); |
| 217 |
| 218 // Duplicates (or adds a reference to) an OS certificate handle. |
| 219 static OSCertHandle DupOSCertHandle(OSCertHandle cert_handle); |
| 220 |
| 221 // Frees (or releases a reference to) an OS certificate handle. |
| 222 static void FreeOSCertHandle(OSCertHandle cert_handle); |
213 | 223 |
214 private: | 224 private: |
215 friend class base::RefCountedThreadSafe<X509Certificate>; | 225 friend class base::RefCountedThreadSafe<X509Certificate>; |
216 FRIEND_TEST(X509CertificateTest, Cache); | 226 FRIEND_TEST(X509CertificateTest, Cache); |
217 FRIEND_TEST(X509CertificateTest, IntermediateCertificates); | 227 FRIEND_TEST(X509CertificateTest, IntermediateCertificates); |
218 | 228 |
219 // A cache of X509Certificate objects. | 229 // A cache of X509Certificate objects. |
220 class Cache { | 230 class Cache { |
221 public: | 231 public: |
222 static Cache* GetInstance(); | 232 static Cache* GetInstance(); |
(...skipping 24 matching lines...) Expand all Loading... |
247 X509Certificate(OSCertHandle cert_handle, Source source, | 257 X509Certificate(OSCertHandle cert_handle, Source source, |
248 const OSCertHandles& intermediates); | 258 const OSCertHandles& intermediates); |
249 | 259 |
250 ~X509Certificate(); | 260 ~X509Certificate(); |
251 | 261 |
252 // Common object initialization code. Called by the constructors only. | 262 // Common object initialization code. Called by the constructors only. |
253 void Initialize(); | 263 void Initialize(); |
254 | 264 |
255 bool VerifyEV() const; | 265 bool VerifyEV() const; |
256 | 266 |
257 // Creates an OS certificate handle from the BER-encoded representation. | |
258 // Returns NULL on failure. | |
259 static OSCertHandle CreateOSCertHandleFromBytes(const char* data, | |
260 int length); | |
261 | |
262 // Duplicates (or adds a reference to) an OS certificate handle. | |
263 static OSCertHandle DupOSCertHandle(OSCertHandle cert_handle); | |
264 | |
265 // Frees (or releases a reference to) an OS certificate handle. | |
266 static void FreeOSCertHandle(OSCertHandle cert_handle); | |
267 | |
268 // Calculates the SHA-1 fingerprint of the certificate. Returns an empty | 267 // Calculates the SHA-1 fingerprint of the certificate. Returns an empty |
269 // (all zero) fingerprint on failure. | 268 // (all zero) fingerprint on failure. |
270 static Fingerprint CalculateFingerprint(OSCertHandle cert_handle); | 269 static Fingerprint CalculateFingerprint(OSCertHandle cert_handle); |
271 | 270 |
272 // The subject of the certificate. | 271 // The subject of the certificate. |
273 Principal subject_; | 272 Principal subject_; |
274 | 273 |
275 // The issuer of the certificate. | 274 // The issuer of the certificate. |
276 Principal issuer_; | 275 Principal issuer_; |
277 | 276 |
(...skipping 23 matching lines...) Expand all Loading... |
301 | 300 |
302 // Where the certificate comes from. | 301 // Where the certificate comes from. |
303 Source source_; | 302 Source source_; |
304 | 303 |
305 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 304 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
306 }; | 305 }; |
307 | 306 |
308 } // namespace net | 307 } // namespace net |
309 | 308 |
310 #endif // NET_BASE_X509_CERTIFICATE_H_ | 309 #endif // NET_BASE_X509_CERTIFICATE_H_ |
OLD | NEW |