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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Returns true if the certificate has a PolicyConstraints extension. | 201 // Returns true if the certificate has a PolicyConstraints extension. |
202 bool has_policy_constraints() const { return has_policy_constraints_; } | 202 bool has_policy_constraints() const { return has_policy_constraints_; } |
203 | 203 |
204 // Returns the ParsedPolicyConstraints struct. Caller must check | 204 // Returns the ParsedPolicyConstraints struct. Caller must check |
205 // has_policy_constraints() before accessing this. | 205 // has_policy_constraints() before accessing this. |
206 const ParsedPolicyConstraints& policy_constraints() const { | 206 const ParsedPolicyConstraints& policy_constraints() const { |
207 DCHECK(has_policy_constraints_); | 207 DCHECK(has_policy_constraints_); |
208 return policy_constraints_; | 208 return policy_constraints_; |
209 } | 209 } |
210 | 210 |
| 211 // Returns true if the certificate has a PolicyMappings extension. |
| 212 bool has_policy_mappings() const { return has_policy_mappings_; } |
| 213 |
| 214 // Returns the PolicyMappings extension. Caller must check |
| 215 // has_policy_mappings() before accessing this. |
| 216 const std::vector<ParsedPolicyMapping>& policy_mappings() const { |
| 217 DCHECK(has_policy_mappings_); |
| 218 return policy_mappings_; |
| 219 } |
| 220 |
| 221 // Returns true if the certificate has a InhibitAnyPolicy extension. |
| 222 bool has_inhibit_any_policy() const { return has_inhibit_any_policy_; } |
| 223 |
| 224 // Returns the Inhibit Any Policy extension. Caller must check |
| 225 // has_inhibit_any_policy() before accessing this. |
| 226 uint8_t inhibit_any_policy() const { |
| 227 DCHECK(has_inhibit_any_policy_); |
| 228 return inhibit_any_policy_; |
| 229 } |
| 230 |
211 // Returns a map of all the extensions in the certificate. | 231 // Returns a map of all the extensions in the certificate. |
212 const ExtensionsMap& extensions() const { return extensions_; } | 232 const ExtensionsMap& extensions() const { return extensions_; } |
213 | 233 |
214 // Gets the value for extension matching |extension_oid|. Returns false if the | 234 // Gets the value for extension matching |extension_oid|. Returns false if the |
215 // extension is not present. | 235 // extension is not present. |
216 bool GetExtension(const der::Input& extension_oid, | 236 bool GetExtension(const der::Input& extension_oid, |
217 ParsedExtension* parsed_extension) const; | 237 ParsedExtension* parsed_extension) const; |
218 | 238 |
219 private: | 239 private: |
220 friend class base::RefCountedThreadSafe<ParsedCertificate>; | 240 friend class base::RefCountedThreadSafe<ParsedCertificate>; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 std::vector<base::StringPiece> ocsp_uris_; | 301 std::vector<base::StringPiece> ocsp_uris_; |
282 | 302 |
283 // Policies extension. | 303 // Policies extension. |
284 bool has_policy_oids_ = false; | 304 bool has_policy_oids_ = false; |
285 std::vector<der::Input> policy_oids_; | 305 std::vector<der::Input> policy_oids_; |
286 | 306 |
287 // Policy constraints extension. | 307 // Policy constraints extension. |
288 bool has_policy_constraints_ = false; | 308 bool has_policy_constraints_ = false; |
289 ParsedPolicyConstraints policy_constraints_; | 309 ParsedPolicyConstraints policy_constraints_; |
290 | 310 |
| 311 // Policy mappings extension. |
| 312 bool has_policy_mappings_ = false; |
| 313 std::vector<ParsedPolicyMapping> policy_mappings_; |
| 314 |
| 315 // Inhibit Any Policy extension. |
| 316 bool has_inhibit_any_policy_ = false; |
| 317 uint8_t inhibit_any_policy_; |
| 318 |
291 // All of the extensions. | 319 // All of the extensions. |
292 ExtensionsMap extensions_; | 320 ExtensionsMap extensions_; |
293 | 321 |
294 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); | 322 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); |
295 }; | 323 }; |
296 | 324 |
297 } // namespace net | 325 } // namespace net |
298 | 326 |
299 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ | 327 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ |
OLD | NEW |