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

Side by Side Diff: net/cert/x509_certificate.h

Issue 1720653002: Add new functions to handle UPN and email addresses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't squash 10 other commits into the same CL Created 4 years, 10 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 | « no previous file | net/cert/x509_certificate_nss.cc » ('j') | net/cert/x509_util.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_X509_CERTIFICATE_H_ 5 #ifndef NET_CERT_X509_CERTIFICATE_H_
6 #define NET_CERT_X509_CERTIFICATE_H_ 6 #define NET_CERT_X509_CERTIFICATE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 PICKLETYPE_CERTIFICATE_CHAIN_V2, 127 PICKLETYPE_CERTIFICATE_CHAIN_V2,
128 128
129 // The Pickle contains the certificate and any certificates that were 129 // The Pickle contains the certificate and any certificates that were
130 // stored in |intermediate_ca_certs_| at the time it was serialized. 130 // stored in |intermediate_ca_certs_| at the time it was serialized.
131 // The format is [int count], [data - this certificate], 131 // The format is [int count], [data - this certificate],
132 // [data - intermediate1], ... [data - intermediateN]. 132 // [data - intermediate1], ... [data - intermediateN].
133 // All certificates are stored in DER form. 133 // All certificates are stored in DER form.
134 PICKLETYPE_CERTIFICATE_CHAIN_V3, 134 PICKLETYPE_CERTIFICATE_CHAIN_V3,
135 }; 135 };
136 136
137 // Allows the caller to filter the subjectAltName list and return only
138 // a specific data type (e.g. email addresses or Microsoft User Principal
139 // Name).
140 enum SubjectAltNameType {
141 SAN_RFC822_NAME,
142 SAN_DNS_NAME,
143 SAN_URI,
Ryan Sleevi 2016/02/27 00:38:45 Concrete reasons I don't like this: Exposing RFC 8
Kevin Cernekee 2016/02/27 19:06:23 Done.
144 SAN_IP_ADDRESS,
145 SAN_UPN,
146 };
147
137 // Creates a X509Certificate from the ground up. Used by tests that simulate 148 // Creates a X509Certificate from the ground up. Used by tests that simulate
138 // SSL connections. 149 // SSL connections.
139 X509Certificate(const std::string& subject, const std::string& issuer, 150 X509Certificate(const std::string& subject, const std::string& issuer,
140 base::Time start_date, base::Time expiration_date); 151 base::Time start_date, base::Time expiration_date);
141 152
142 // Create an X509Certificate from a handle to the certificate object in the 153 // Create an X509Certificate from a handle to the certificate object in the
143 // underlying crypto library. 154 // underlying crypto library.
144 static scoped_refptr<X509Certificate> CreateFromHandle( 155 static scoped_refptr<X509Certificate> CreateFromHandle(
145 OSCertHandle cert_handle, 156 OSCertHandle cert_handle,
146 const OSCertHandles& intermediates); 157 const OSCertHandles& intermediates);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Otherwise, it gets the common name in the subject field. 238 // Otherwise, it gets the common name in the subject field.
228 void GetDNSNames(std::vector<std::string>* dns_names) const; 239 void GetDNSNames(std::vector<std::string>* dns_names) const;
229 240
230 // Gets the subjectAltName extension field from the certificate, if any. 241 // Gets the subjectAltName extension field from the certificate, if any.
231 // For future extension; currently this only returns those name types that 242 // For future extension; currently this only returns those name types that
232 // are required for HTTP certificate name verification - see VerifyHostname. 243 // are required for HTTP certificate name verification - see VerifyHostname.
233 // Unrequired parameters may be passed as NULL. 244 // Unrequired parameters may be passed as NULL.
234 void GetSubjectAltName(std::vector<std::string>* dns_names, 245 void GetSubjectAltName(std::vector<std::string>* dns_names,
235 std::vector<std::string>* ip_addrs) const; 246 std::vector<std::string>* ip_addrs) const;
236 247
248 // Gets a specific type of subjectAltName only. Currently implemented
249 // for NSS.
250 void GetSubjectAltName(SubjectAltNameType type,
251 std::vector<std::string>* names) const;
252
237 // Convenience method that returns whether this certificate has expired as of 253 // Convenience method that returns whether this certificate has expired as of
238 // now. 254 // now.
239 bool HasExpired() const; 255 bool HasExpired() const;
240 256
241 // Returns true if this object and |other| represent the same certificate. 257 // Returns true if this object and |other| represent the same certificate.
242 bool Equals(const X509Certificate* other) const; 258 bool Equals(const X509Certificate* other) const;
243 259
244 // Returns intermediate certificates added via AddIntermediateCertificate(). 260 // Returns intermediate certificates added via AddIntermediateCertificate().
245 // Ownership follows the "get" rule: it is the caller's responsibility to 261 // Ownership follows the "get" rule: it is the caller's responsibility to
246 // retain the elements of the result. 262 // retain the elements of the result.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 // based on the type of the certificate. 533 // based on the type of the certificate.
518 std::string default_nickname_; 534 std::string default_nickname_;
519 #endif 535 #endif
520 536
521 DISALLOW_COPY_AND_ASSIGN(X509Certificate); 537 DISALLOW_COPY_AND_ASSIGN(X509Certificate);
522 }; 538 };
523 539
524 } // namespace net 540 } // namespace net
525 541
526 #endif // NET_CERT_X509_CERTIFICATE_H_ 542 #endif // NET_CERT_X509_CERTIFICATE_H_
OLDNEW
« no previous file with comments | « no previous file | net/cert/x509_certificate_nss.cc » ('j') | net/cert/x509_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698