| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 const char* data, int length, Format format); | 276 const char* data, int length, Format format); |
| 277 | 277 |
| 278 // Duplicates (or adds a reference to) an OS certificate handle. | 278 // Duplicates (or adds a reference to) an OS certificate handle. |
| 279 static OSCertHandle DupOSCertHandle(OSCertHandle cert_handle); | 279 static OSCertHandle DupOSCertHandle(OSCertHandle cert_handle); |
| 280 | 280 |
| 281 // Frees (or releases a reference to) an OS certificate handle. | 281 // Frees (or releases a reference to) an OS certificate handle. |
| 282 static void FreeOSCertHandle(OSCertHandle cert_handle); | 282 static void FreeOSCertHandle(OSCertHandle cert_handle); |
| 283 | 283 |
| 284 private: | 284 private: |
| 285 friend class base::RefCountedThreadSafe<X509Certificate>; | 285 friend class base::RefCountedThreadSafe<X509Certificate>; |
| 286 friend class TestRootCerts; // For unit tests |
| 286 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, Cache); | 287 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, Cache); |
| 287 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, IntermediateCertificates); | 288 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, IntermediateCertificates); |
| 288 | 289 |
| 289 // Construct an X509Certificate from a handle to the certificate object | 290 // Construct an X509Certificate from a handle to the certificate object |
| 290 // in the underlying crypto library. | 291 // in the underlying crypto library. |
| 291 X509Certificate(OSCertHandle cert_handle, Source source, | 292 X509Certificate(OSCertHandle cert_handle, Source source, |
| 292 const OSCertHandles& intermediates); | 293 const OSCertHandles& intermediates); |
| 293 | 294 |
| 294 ~X509Certificate(); | 295 ~X509Certificate(); |
| 295 | 296 |
| 296 // Common object initialization code. Called by the constructors only. | 297 // Common object initialization code. Called by the constructors only. |
| 297 void Initialize(); | 298 void Initialize(); |
| 298 | 299 |
| 299 #if defined(OS_WIN) | 300 #if defined(OS_WIN) |
| 300 bool CheckEV(PCCERT_CHAIN_CONTEXT chain_context, | 301 bool CheckEV(PCCERT_CHAIN_CONTEXT chain_context, |
| 301 const char* policy_oid) const; | 302 const char* policy_oid) const; |
| 302 #endif | 303 #endif |
| 303 bool VerifyEV() const; | 304 bool VerifyEV() const; |
| 304 | 305 |
| 306 #if defined(USE_OPENSSL) |
| 307 // Resets the store returned by cert_store() to default state. Used by |
| 308 // TestRootCerts to undo modifications. |
| 309 static void ResetCertStore(); |
| 310 #endif |
| 311 |
| 305 // Calculates the SHA-1 fingerprint of the certificate. Returns an empty | 312 // Calculates the SHA-1 fingerprint of the certificate. Returns an empty |
| 306 // (all zero) fingerprint on failure. | 313 // (all zero) fingerprint on failure. |
| 307 static SHA1Fingerprint CalculateFingerprint(OSCertHandle cert_handle); | 314 static SHA1Fingerprint CalculateFingerprint(OSCertHandle cert_handle); |
| 308 | 315 |
| 309 // The subject of the certificate. | 316 // The subject of the certificate. |
| 310 CertPrincipal subject_; | 317 CertPrincipal subject_; |
| 311 | 318 |
| 312 // The issuer of the certificate. | 319 // The issuer of the certificate. |
| 313 CertPrincipal issuer_; | 320 CertPrincipal issuer_; |
| 314 | 321 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 336 | 343 |
| 337 // Where the certificate comes from. | 344 // Where the certificate comes from. |
| 338 Source source_; | 345 Source source_; |
| 339 | 346 |
| 340 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 347 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
| 341 }; | 348 }; |
| 342 | 349 |
| 343 } // namespace net | 350 } // namespace net |
| 344 | 351 |
| 345 #endif // NET_BASE_X509_CERTIFICATE_H_ | 352 #endif // NET_BASE_X509_CERTIFICATE_H_ |
| OLD | NEW |