| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CERT_INTERNAL_PARSED_CERTIFICATE_H_ | 5 #ifndef NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ |
| 6 #define NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ | 6 #define NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Returns true if the certificate has a NameConstraints extension. | 145 // Returns true if the certificate has a NameConstraints extension. |
| 146 bool has_name_constraints() const { return name_constraints_ != nullptr; } | 146 bool has_name_constraints() const { return name_constraints_ != nullptr; } |
| 147 | 147 |
| 148 // Returns the parsed NameConstraints extension. Must not be called if | 148 // Returns the parsed NameConstraints extension. Must not be called if |
| 149 // has_name_constraints() is false. | 149 // has_name_constraints() is false. |
| 150 const NameConstraints& name_constraints() const { | 150 const NameConstraints& name_constraints() const { |
| 151 DCHECK(name_constraints_); | 151 DCHECK(name_constraints_); |
| 152 return *name_constraints_; | 152 return *name_constraints_; |
| 153 } | 153 } |
| 154 | 154 |
| 155 // Returns true if the certificate has an AuthorityInfoAccess extension. |
| 156 bool has_authority_info_access() const { return has_authority_info_access_; } |
| 157 |
| 158 // Returns the ParsedExtension struct for the AuthorityInfoAccess extension. |
| 159 const ParsedExtension& authority_info_access_extension() const { |
| 160 return authority_info_access_extension_; |
| 161 } |
| 162 |
| 163 // Returns any caIssuers URIs from the AuthorityInfoAccess extension. |
| 164 const std::vector<base::StringPiece>& ca_issuers_uris() const { |
| 165 return ca_issuers_uris_; |
| 166 } |
| 167 |
| 168 // Returns any OCSP URIs from the AuthorityInfoAccess extension. |
| 169 const std::vector<base::StringPiece>& ocsp_uris() const { return ocsp_uris_; } |
| 170 |
| 155 // Returns a map of unhandled extensions (excludes the ones above). | 171 // Returns a map of unhandled extensions (excludes the ones above). |
| 156 const ExtensionsMap& unparsed_extensions() const { | 172 const ExtensionsMap& unparsed_extensions() const { |
| 157 return unparsed_extensions_; | 173 return unparsed_extensions_; |
| 158 } | 174 } |
| 159 | 175 |
| 160 private: | 176 private: |
| 161 friend class base::RefCountedThreadSafe<ParsedCertificate>; | 177 friend class base::RefCountedThreadSafe<ParsedCertificate>; |
| 162 ParsedCertificate(); | 178 ParsedCertificate(); |
| 163 ~ParsedCertificate(); | 179 ~ParsedCertificate(); |
| 164 | 180 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 195 der::BitString key_usage_; | 211 der::BitString key_usage_; |
| 196 | 212 |
| 197 // Raw SubjectAltName extension. | 213 // Raw SubjectAltName extension. |
| 198 ParsedExtension subject_alt_names_extension_; | 214 ParsedExtension subject_alt_names_extension_; |
| 199 // Parsed SubjectAltName extension. | 215 // Parsed SubjectAltName extension. |
| 200 std::unique_ptr<GeneralNames> subject_alt_names_; | 216 std::unique_ptr<GeneralNames> subject_alt_names_; |
| 201 | 217 |
| 202 // NameConstraints extension. | 218 // NameConstraints extension. |
| 203 std::unique_ptr<NameConstraints> name_constraints_; | 219 std::unique_ptr<NameConstraints> name_constraints_; |
| 204 | 220 |
| 221 // AuthorityInfoAccess extension. |
| 222 bool has_authority_info_access_ = false; |
| 223 ParsedExtension authority_info_access_extension_; |
| 224 // CaIssuers and Ocsp URIs parsed from the AuthorityInfoAccess extension. Note |
| 225 // that the AuthorityInfoAccess may have contained other AccessDescriptions |
| 226 // which are not represented here. |
| 227 std::vector<base::StringPiece> ca_issuers_uris_; |
| 228 std::vector<base::StringPiece> ocsp_uris_; |
| 229 |
| 205 // The remaining extensions (excludes the standard ones above). | 230 // The remaining extensions (excludes the standard ones above). |
| 206 ExtensionsMap unparsed_extensions_; | 231 ExtensionsMap unparsed_extensions_; |
| 207 | 232 |
| 208 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); | 233 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); |
| 209 }; | 234 }; |
| 210 | 235 |
| 211 } // namespace net | 236 } // namespace net |
| 212 | 237 |
| 213 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ | 238 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ |
| OLD | NEW |