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

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

Issue 2872113002: Add parsing code for RFC 5280 PolicyConstraints. (Closed)
Patch Set: 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
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>
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Returns true if the certificate has a Policies extension. 190 // Returns true if the certificate has a Policies extension.
191 bool has_policy_oids() const { return has_policy_oids_; } 191 bool has_policy_oids() const { return has_policy_oids_; }
192 192
193 // Returns the policy OIDs. Caller must check has_policy_oids() before 193 // Returns the policy OIDs. Caller must check has_policy_oids() before
194 // accessing this. 194 // accessing this.
195 const std::vector<der::Input>& policy_oids() const { 195 const std::vector<der::Input>& policy_oids() const {
196 DCHECK(has_policy_oids()); 196 DCHECK(has_policy_oids());
197 return policy_oids_; 197 return policy_oids_;
198 } 198 }
199 199
200 // Returns true if the certificate has a PolicyConstraints extension.
201 bool has_policy_constraints() const { return has_policy_constraints_; }
202
203 // Returns the ParsedPolicyConstraints struct. Caller must check
204 // has_policy_constraints() before accessing this.
205 const ParsedPolicyConstraints& policy_constraints() const {
206 DCHECK(has_policy_constraints_);
207 return policy_constraints_;
208 }
209
200 // Returns a map of all the extensions in the certificate. 210 // Returns a map of all the extensions in the certificate.
201 const ExtensionsMap& extensions() const { return extensions_; } 211 const ExtensionsMap& extensions() const { return extensions_; }
202 212
203 // Gets the value for extension matching |extension_oid|. Returns false if the 213 // Gets the value for extension matching |extension_oid|. Returns false if the
204 // extension is not present. 214 // extension is not present.
205 bool GetExtension(const der::Input& extension_oid, 215 bool GetExtension(const der::Input& extension_oid,
206 ParsedExtension* parsed_extension) const; 216 ParsedExtension* parsed_extension) const;
207 217
208 private: 218 private:
209 friend class base::RefCountedThreadSafe<ParsedCertificate>; 219 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 276 // CaIssuers and Ocsp URIs parsed from the AuthorityInfoAccess extension. Note
267 // that the AuthorityInfoAccess may have contained other AccessDescriptions 277 // that the AuthorityInfoAccess may have contained other AccessDescriptions
268 // which are not represented here. 278 // which are not represented here.
269 std::vector<base::StringPiece> ca_issuers_uris_; 279 std::vector<base::StringPiece> ca_issuers_uris_;
270 std::vector<base::StringPiece> ocsp_uris_; 280 std::vector<base::StringPiece> ocsp_uris_;
271 281
272 // Policies extension. 282 // Policies extension.
273 bool has_policy_oids_ = false; 283 bool has_policy_oids_ = false;
274 std::vector<der::Input> policy_oids_; 284 std::vector<der::Input> policy_oids_;
275 285
286 // Policy constraints extension.
287 bool has_policy_constraints_ = false;
288 ParsedPolicyConstraints policy_constraints_;
289
276 // All of the extensions. 290 // All of the extensions.
277 ExtensionsMap extensions_; 291 ExtensionsMap extensions_;
278 292
279 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); 293 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate);
280 }; 294 };
281 295
282 } // namespace net 296 } // namespace net
283 297
284 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ 298 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698