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_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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // CertPrincipal represents the issuer or subject field of an X.509 certificate. | 48 // CertPrincipal represents the issuer or subject field of an X.509 certificate. |
49 struct NET_EXPORT CertPrincipal { | 49 struct NET_EXPORT CertPrincipal { |
50 CertPrincipal(); | 50 CertPrincipal(); |
51 explicit CertPrincipal(const std::string& name); | 51 explicit CertPrincipal(const std::string& name); |
52 ~CertPrincipal(); | 52 ~CertPrincipal(); |
53 | 53 |
54 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
55 // Parses a BER-format DistinguishedName. | 55 // Parses a BER-format DistinguishedName. |
56 bool ParseDistinguishedName(const void* ber_name_data, size_t length); | 56 bool ParseDistinguishedName(const void* ber_name_data, size_t length); |
57 | 57 |
58 // Parses a CSSM_X509_NAME struct. | |
59 void Parse(const CSSM_X509_NAME* name); | |
60 | |
61 // Compare this CertPrincipal with |against|, returning true if they're | 58 // Compare this CertPrincipal with |against|, returning true if they're |
62 // equal enough to be a possible match. This should NOT be used for any | 59 // equal enough to be a possible match. This should NOT be used for any |
63 // security relevant decisions. | 60 // security relevant decisions. |
64 // TODO(rsleevi): Remove once Mac client auth uses NSS for name comparison. | 61 // TODO(rsleevi): Remove once Mac client auth uses NSS for name comparison. |
65 bool Matches(const CertPrincipal& against) const; | 62 bool Matches(const CertPrincipal& against) const; |
66 #endif | 63 #endif |
67 | 64 |
68 // Returns a name that can be used to represent the issuer. It tries in this | 65 // Returns a name that can be used to represent the issuer. It tries in this |
69 // order: CN, O and OU and returns the first non-empty one found. | 66 // order: CN, O and OU and returns the first non-empty one found. |
70 std::string GetDisplayName() const; | 67 std::string GetDisplayName() const; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as | 143 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as |
147 // |format|, and writes the result into |*time|. If an invalid date is | 144 // |format|, and writes the result into |*time|. If an invalid date is |
148 // specified, or if parsing fails, returns false, and |*time| will not be | 145 // specified, or if parsing fails, returns false, and |*time| will not be |
149 // updated. | 146 // updated. |
150 bool ParseCertificateDate(const base::StringPiece& raw_date, | 147 bool ParseCertificateDate(const base::StringPiece& raw_date, |
151 CertDateFormat format, | 148 CertDateFormat format, |
152 base::Time* time); | 149 base::Time* time); |
153 } // namespace net | 150 } // namespace net |
154 | 151 |
155 #endif // NET_BASE_X509_CERT_TYPES_H_ | 152 #endif // NET_BASE_X509_CERT_TYPES_H_ |
OLD | NEW |