Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: net/cert/internal/parsed_certificate.h

Issue 2872113002: Add parsing code for RFC 5280 PolicyConstraints. (Closed)
Patch Set: update ios bundle_data Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/cert/internal/parse_certificate.cc ('k') | net/cert/internal/parsed_certificate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 #include "net/cert/internal/certificate_policies.h"
14 #include "net/cert/internal/parse_certificate.h" 15 #include "net/cert/internal/parse_certificate.h"
15 #include "net/der/input.h" 16 #include "net/der/input.h"
16 #include "third_party/boringssl/src/include/openssl/base.h" 17 #include "third_party/boringssl/src/include/openssl/base.h"
17 18
18 namespace net { 19 namespace net {
19 20
20 struct GeneralNames; 21 struct GeneralNames;
21 class NameConstraints; 22 class NameConstraints;
22 class ParsedCertificate; 23 class ParsedCertificate;
23 class SignatureAlgorithm; 24 class SignatureAlgorithm;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Returns true if the certificate has a Policies extension. 191 // Returns true if the certificate has a Policies extension.
191 bool has_policy_oids() const { return has_policy_oids_; } 192 bool has_policy_oids() const { return has_policy_oids_; }
192 193
193 // Returns the policy OIDs. Caller must check has_policy_oids() before 194 // Returns the policy OIDs. Caller must check has_policy_oids() before
194 // accessing this. 195 // accessing this.
195 const std::vector<der::Input>& policy_oids() const { 196 const std::vector<der::Input>& policy_oids() const {
196 DCHECK(has_policy_oids()); 197 DCHECK(has_policy_oids());
197 return policy_oids_; 198 return policy_oids_;
198 } 199 }
199 200
201 // Returns true if the certificate has a PolicyConstraints extension.
202 bool has_policy_constraints() const { return has_policy_constraints_; }
203
204 // Returns the ParsedPolicyConstraints struct. Caller must check
205 // has_policy_constraints() before accessing this.
206 const ParsedPolicyConstraints& policy_constraints() const {
207 DCHECK(has_policy_constraints_);
208 return policy_constraints_;
209 }
210
200 // Returns a map of all the extensions in the certificate. 211 // Returns a map of all the extensions in the certificate.
201 const ExtensionsMap& extensions() const { return extensions_; } 212 const ExtensionsMap& extensions() const { return extensions_; }
202 213
203 // Gets the value for extension matching |extension_oid|. Returns false if the 214 // Gets the value for extension matching |extension_oid|. Returns false if the
204 // extension is not present. 215 // extension is not present.
205 bool GetExtension(const der::Input& extension_oid, 216 bool GetExtension(const der::Input& extension_oid,
206 ParsedExtension* parsed_extension) const; 217 ParsedExtension* parsed_extension) const;
207 218
208 private: 219 private:
209 friend class base::RefCountedThreadSafe<ParsedCertificate>; 220 friend class base::RefCountedThreadSafe<ParsedCertificate>;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // CaIssuers and Ocsp URIs parsed from the AuthorityInfoAccess extension. Note 277 // CaIssuers and Ocsp URIs parsed from the AuthorityInfoAccess extension. Note
267 // that the AuthorityInfoAccess may have contained other AccessDescriptions 278 // that the AuthorityInfoAccess may have contained other AccessDescriptions
268 // which are not represented here. 279 // which are not represented here.
269 std::vector<base::StringPiece> ca_issuers_uris_; 280 std::vector<base::StringPiece> ca_issuers_uris_;
270 std::vector<base::StringPiece> ocsp_uris_; 281 std::vector<base::StringPiece> ocsp_uris_;
271 282
272 // Policies extension. 283 // Policies extension.
273 bool has_policy_oids_ = false; 284 bool has_policy_oids_ = false;
274 std::vector<der::Input> policy_oids_; 285 std::vector<der::Input> policy_oids_;
275 286
287 // Policy constraints extension.
288 bool has_policy_constraints_ = false;
289 ParsedPolicyConstraints policy_constraints_;
290
276 // All of the extensions. 291 // All of the extensions.
277 ExtensionsMap extensions_; 292 ExtensionsMap extensions_;
278 293
279 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); 294 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate);
280 }; 295 };
281 296
282 } // namespace net 297 } // namespace net
283 298
284 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ 299 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_
OLDNEW
« no previous file with comments | « net/cert/internal/parse_certificate.cc ('k') | net/cert/internal/parsed_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698