| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CERT_TYPES_H_ | 5 #ifndef NET_BASE_X509_CERT_TYPES_H_ |
| 6 #define NET_BASE_X509_CERT_TYPES_H_ | 6 #define NET_BASE_X509_CERT_TYPES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 : public std::binary_function<SHA1Fingerprint, SHA1Fingerprint, bool> { | 46 : public std::binary_function<SHA1Fingerprint, SHA1Fingerprint, bool> { |
| 47 public: | 47 public: |
| 48 bool operator() (const SHA1Fingerprint& lhs, | 48 bool operator() (const SHA1Fingerprint& lhs, |
| 49 const SHA1Fingerprint& rhs) const { | 49 const SHA1Fingerprint& rhs) const { |
| 50 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; | 50 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; |
| 51 } | 51 } |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // CertPrincipal represents the issuer or subject field of an X.509 certificate. | 54 // CertPrincipal represents the issuer or subject field of an X.509 certificate. |
| 55 struct CertPrincipal { | 55 struct CertPrincipal { |
| 56 CertPrincipal() { } | 56 CertPrincipal(); |
| 57 explicit CertPrincipal(const std::string& name) : common_name(name) { } | 57 explicit CertPrincipal(const std::string& name); |
| 58 ~CertPrincipal(); |
| 58 | 59 |
| 59 // Parses a BER-format DistinguishedName. | 60 // Parses a BER-format DistinguishedName. |
| 60 bool ParseDistinguishedName(const void* ber_name_data, size_t length); | 61 bool ParseDistinguishedName(const void* ber_name_data, size_t length); |
| 61 | 62 |
| 62 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
| 63 // Parses a CSSM_X509_NAME struct. | 64 // Parses a CSSM_X509_NAME struct. |
| 64 void Parse(const CSSM_X509_NAME* name); | 65 void Parse(const CSSM_X509_NAME* name); |
| 65 #endif | 66 #endif |
| 66 | 67 |
| 67 // Returns true if all attributes of the two objects match, | 68 // Returns true if all attributes of the two objects match, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 98 // We don't have policy information for this certificate. | 99 // We don't have policy information for this certificate. |
| 99 UNKNOWN, | 100 UNKNOWN, |
| 100 | 101 |
| 101 // This certificate is allowed. | 102 // This certificate is allowed. |
| 102 ALLOWED, | 103 ALLOWED, |
| 103 | 104 |
| 104 // This certificate is denied. | 105 // This certificate is denied. |
| 105 DENIED, | 106 DENIED, |
| 106 }; | 107 }; |
| 107 | 108 |
| 109 CertPolicy(); |
| 110 ~CertPolicy(); |
| 111 |
| 108 // Returns the judgment this policy makes about this certificate. | 112 // Returns the judgment this policy makes about this certificate. |
| 109 Judgment Check(X509Certificate* cert) const; | 113 Judgment Check(X509Certificate* cert) const; |
| 110 | 114 |
| 111 // Causes the policy to allow this certificate. | 115 // Causes the policy to allow this certificate. |
| 112 void Allow(X509Certificate* cert); | 116 void Allow(X509Certificate* cert); |
| 113 | 117 |
| 114 // Causes the policy to deny this certificate. | 118 // Causes the policy to deny this certificate. |
| 115 void Deny(X509Certificate* cert); | 119 void Deny(X509Certificate* cert); |
| 116 | 120 |
| 117 // Returns true if this policy has allowed at least one certificate. | 121 // Returns true if this policy has allowed at least one certificate. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 132 // Compares two OIDs by value. | 136 // Compares two OIDs by value. |
| 133 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { | 137 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { |
| 134 return oid1->Length == oid2->Length && | 138 return oid1->Length == oid2->Length && |
| 135 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); | 139 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); |
| 136 } | 140 } |
| 137 #endif | 141 #endif |
| 138 | 142 |
| 139 } // namespace net | 143 } // namespace net |
| 140 | 144 |
| 141 #endif // NET_BASE_X509_CERT_TYPES_H_ | 145 #endif // NET_BASE_X509_CERT_TYPES_H_ |
| OLD | NEW |