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

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

Issue 2331323005: Harden an API that takes base::StringPiece to give a compile error if (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | 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>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 ParsedCertificate(); 220 ParsedCertificate();
221 ~ParsedCertificate(); 221 ~ParsedCertificate();
222 222
223 static scoped_refptr<ParsedCertificate> CreateInternal( 223 static scoped_refptr<ParsedCertificate> CreateInternal(
224 const uint8_t* data, 224 const uint8_t* data,
225 size_t length, 225 size_t length,
226 DataSource source, 226 DataSource source,
227 const ParseCertificateOptions& options, 227 const ParseCertificateOptions& options,
228 CertErrors* errors); 228 CertErrors* errors);
229 229
230 // These private overloads should not be used, and have no definition.
231 //
232 // They are here to prevent incorrectly passing a const char*
233 // in place of a base::StringPiece (thanks to StringPiece implicit
234 // ctor on const char*).
235 //
236 // Accidentally inflating a const char* (without length) to a
237 // StringPiece would be a bug.
238 static scoped_refptr<ParsedCertificate> Create(
239 const char* invalid_data,
240 const ParseCertificateOptions& options,
241 CertErrors* errors);
242 static bool CreateAndAddToVector(
243 const char* data,
244 const ParseCertificateOptions& options,
245 std::vector<scoped_refptr<net::ParsedCertificate>>* chain,
246 CertErrors* errors);
247
230 // The backing store for the certificate data. This is only applicable when 248 // The backing store for the certificate data. This is only applicable when
231 // the ParsedCertificate was initialized using DataSource::INTERNAL_COPY. 249 // the ParsedCertificate was initialized using DataSource::INTERNAL_COPY.
232 std::vector<uint8_t> cert_data_; 250 std::vector<uint8_t> cert_data_;
233 251
234 // Note that the backing data for |cert_| (and its may come either from 252 // Note that the backing data for |cert_| (and its may come either from
235 // |cert_data_| or some external buffer (depending on how the 253 // |cert_data_| or some external buffer (depending on how the
236 // ParsedCertificate was created). 254 // ParsedCertificate was created).
237 255
238 // Points to the raw certificate DER. 256 // Points to the raw certificate DER.
239 der::Input cert_; 257 der::Input cert_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 296
279 // The remaining extensions (excludes the standard ones above). 297 // The remaining extensions (excludes the standard ones above).
280 ExtensionsMap unparsed_extensions_; 298 ExtensionsMap unparsed_extensions_;
281 299
282 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); 300 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate);
283 }; 301 };
284 302
285 } // namespace net 303 } // namespace net
286 304
287 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ 305 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698