| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Creates a ParsedCertificate given a DER-encoded Certificate. Returns | 44 // Creates a ParsedCertificate given a DER-encoded Certificate. Returns |
| 45 // nullptr on failure. Failure will occur if the standard certificate fields | 45 // nullptr on failure. Failure will occur if the standard certificate fields |
| 46 // and supported extensions cannot be parsed. | 46 // and supported extensions cannot be parsed. |
| 47 // | 47 // |
| 48 // The provided certificate data is either copied, or aliased, depending on | 48 // The provided certificate data is either copied, or aliased, depending on |
| 49 // the value of |source|. See the comments for DataSource for details. | 49 // the value of |source|. See the comments for DataSource for details. |
| 50 static scoped_refptr<ParsedCertificate> CreateFromCertificateData( | 50 static scoped_refptr<ParsedCertificate> CreateFromCertificateData( |
| 51 const uint8_t* data, | 51 const uint8_t* data, |
| 52 size_t length, | 52 size_t length, |
| 53 DataSource source); | 53 DataSource source, |
| 54 const ParseCertificateOptions& options); |
| 54 | 55 |
| 55 // Creates a ParsedCertificate and appends it to |chain|. Returns true if the | 56 // Creates a ParsedCertificate and appends it to |chain|. Returns true if the |
| 56 // certificate was successfully parsed and added. If false is return, |chain| | 57 // certificate was successfully parsed and added. If false is return, |chain| |
| 57 // is unmodified. | 58 // is unmodified. |
| 58 static bool CreateAndAddToVector( | 59 static bool CreateAndAddToVector( |
| 59 const uint8_t* data, | 60 const uint8_t* data, |
| 60 size_t length, | 61 size_t length, |
| 61 DataSource source, | 62 DataSource source, |
| 63 const ParseCertificateOptions& options, |
| 62 std::vector<scoped_refptr<net::ParsedCertificate>>* chain); | 64 std::vector<scoped_refptr<net::ParsedCertificate>>* chain); |
| 63 | 65 |
| 64 // Creates a ParsedCertificate, copying the data from |data|. | 66 // Creates a ParsedCertificate, copying the data from |data|. |
| 65 static scoped_refptr<ParsedCertificate> CreateFromCertificateCopy( | 67 static scoped_refptr<ParsedCertificate> CreateFromCertificateCopy( |
| 66 const base::StringPiece& data); | 68 const base::StringPiece& data, |
| 69 const ParseCertificateOptions& options); |
| 67 | 70 |
| 68 // Returns the DER-encoded certificate data for this cert. | 71 // Returns the DER-encoded certificate data for this cert. |
| 69 const der::Input& der_cert() const { return cert_; } | 72 const der::Input& der_cert() const { return cert_; } |
| 70 | 73 |
| 71 // Accessors for raw fields of the Certificate. | 74 // Accessors for raw fields of the Certificate. |
| 72 const der::Input& tbs_certificate_tlv() const { return tbs_certificate_tlv_; } | 75 const der::Input& tbs_certificate_tlv() const { return tbs_certificate_tlv_; } |
| 73 | 76 |
| 74 const der::Input& signature_algorithm_tlv() const { | 77 const der::Input& signature_algorithm_tlv() const { |
| 75 return signature_algorithm_tlv_; | 78 return signature_algorithm_tlv_; |
| 76 } | 79 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 232 |
| 230 // The remaining extensions (excludes the standard ones above). | 233 // The remaining extensions (excludes the standard ones above). |
| 231 ExtensionsMap unparsed_extensions_; | 234 ExtensionsMap unparsed_extensions_; |
| 232 | 235 |
| 233 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); | 236 DISALLOW_COPY_AND_ASSIGN(ParsedCertificate); |
| 234 }; | 237 }; |
| 235 | 238 |
| 236 } // namespace net | 239 } // namespace net |
| 237 | 240 |
| 238 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ | 241 #endif // NET_CERT_INTERNAL_PARSED_CERTIFICATE_H_ |
| OLD | NEW |