OLD | NEW |
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 #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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // Returns true if I already contain all the given intermediate certs. | 250 // Returns true if I already contain all the given intermediate certs. |
251 bool HasIntermediateCertificates(const OSCertHandles& certs); | 251 bool HasIntermediateCertificates(const OSCertHandles& certs); |
252 | 252 |
253 #if defined(OS_MACOSX) | 253 #if defined(OS_MACOSX) |
254 // Does this certificate's usage allow SSL client authentication? | 254 // Does this certificate's usage allow SSL client authentication? |
255 bool SupportsSSLClientAuth() const; | 255 bool SupportsSSLClientAuth() const; |
256 | 256 |
257 // Do any of the given issuer names appear in this cert's chain of trust? | 257 // Do any of the given issuer names appear in this cert's chain of trust? |
258 bool IsIssuedBy(const std::vector<CertPrincipal>& valid_issuers); | 258 bool IsIssuedBy(const std::vector<CertPrincipal>& valid_issuers); |
259 | 259 |
260 // Creates a security policy for SSL client certificates. | 260 // Creates a security policy for certificates used as client certificates |
261 static OSStatus CreateSSLClientPolicy(SecPolicyRef* outPolicy); | 261 // in SSL. |
| 262 // If a policy is successfully created, it will be stored in |
| 263 // |*policy| and ownership transferred to the caller. |
| 264 static OSStatus CreateSSLClientPolicy(SecPolicyRef* policy); |
| 265 |
| 266 // Creates a security policy for certificates used by SSL servers. |
| 267 // |hostname| is an optionally-supplied string indicating the name to verify |
| 268 // the server certificate as; if it is empty, no hostname verification will |
| 269 // happen. |
| 270 // If a policy is successfully created, it will be stored in |*policy| and |
| 271 // ownership transferred to the caller. |
| 272 static OSStatus CreateSSLServerPolicy(const std::string& hostname, |
| 273 SecPolicyRef* policy); |
| 274 |
| 275 // Creates a security policy for basic X.509 validation. If the policy is |
| 276 // successfully created, it will be stored in |*policy| and ownership |
| 277 // transferred to the caller. |
| 278 static OSStatus CreateBasicX509Policy(SecPolicyRef* policy); |
| 279 |
| 280 // Creates security policies to control revocation checking (OCSP and CRL). |
| 281 // If |enable_revocation_checking| is false, the policies returned will be |
| 282 // explicitly disabled from accessing the network or the cache. This may be |
| 283 // used to override system settings regarding revocation checking. |
| 284 // If the policies are successfully created, they will be appended to |
| 285 // |policies|. |
| 286 static OSStatus CreateRevocationPolicies(bool enable_revocation_checking, |
| 287 CFMutableArrayRef policies); |
262 | 288 |
263 // Adds all available SSL client identity certs to the given vector. | 289 // Adds all available SSL client identity certs to the given vector. |
264 // |server_domain| is a hint for which domain the cert is to be sent to | 290 // |server_domain| is a hint for which domain the cert is to be sent to |
265 // (a cert previously specified as the default for that domain will be given | 291 // (a cert previously specified as the default for that domain will be given |
266 // precedence and returned first in the output vector.) | 292 // precedence and returned first in the output vector.) |
267 // If valid_issuers is non-empty, only certs that were transitively issued by | 293 // If valid_issuers is non-empty, only certs that were transitively issued |
268 // one of the given names will be included in the list. | 294 // by one of the given names will be included in the list. |
269 static bool GetSSLClientCertificates( | 295 static bool GetSSLClientCertificates( |
270 const std::string& server_domain, | 296 const std::string& server_domain, |
271 const std::vector<CertPrincipal>& valid_issuers, | 297 const std::vector<CertPrincipal>& valid_issuers, |
272 CertificateList* certs); | 298 CertificateList* certs); |
273 | 299 |
274 // Creates the chain of certs to use for this client identity cert. | 300 // Creates the chain of certs to use for this client identity cert. |
275 CFArrayRef CreateClientCertificateChain() const; | 301 CFArrayRef CreateClientCertificateChain() const; |
276 #endif | 302 #endif |
277 | 303 |
278 #if defined(OS_WIN) | 304 #if defined(OS_WIN) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 489 |
464 // Where the certificate comes from. | 490 // Where the certificate comes from. |
465 Source source_; | 491 Source source_; |
466 | 492 |
467 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 493 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
468 }; | 494 }; |
469 | 495 |
470 } // namespace net | 496 } // namespace net |
471 | 497 |
472 #endif // NET_BASE_X509_CERTIFICATE_H_ | 498 #endif // NET_BASE_X509_CERTIFICATE_H_ |
OLD | NEW |