| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NAME_CONSTRAINTS_H_ | 5 #ifndef NET_CERT_INTERNAL_NAME_CONSTRAINTS_H_ |
| 6 #define NET_CERT_INTERNAL_NAME_CONSTRAINTS_H_ | 6 #define NET_CERT_INTERNAL_NAME_CONSTRAINTS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // types is kept, and the names are split into members for each type. Only | 41 // types is kept, and the names are split into members for each type. Only |
| 42 // name types that are handled by this code are stored (though all types are | 42 // name types that are handled by this code are stored (though all types are |
| 43 // recorded in the bitfield.) | 43 // recorded in the bitfield.) |
| 44 // TODO(mattm): move this to some other file? | 44 // TODO(mattm): move this to some other file? |
| 45 struct NET_EXPORT GeneralNames { | 45 struct NET_EXPORT GeneralNames { |
| 46 GeneralNames(); | 46 GeneralNames(); |
| 47 ~GeneralNames(); | 47 ~GeneralNames(); |
| 48 | 48 |
| 49 // Create a GeneralNames object representing the DER-encoded | 49 // Create a GeneralNames object representing the DER-encoded |
| 50 // |general_names_tlv|. | 50 // |general_names_tlv|. |
| 51 static std::unique_ptr<GeneralNames> CreateFromDer( | 51 static std::unique_ptr<GeneralNames> Create( |
| 52 const der::Input& general_names_tlv); | 52 const der::Input& general_names_tlv); |
| 53 | 53 |
| 54 // ASCII hostnames. | 54 // ASCII hostnames. |
| 55 std::vector<std::string> dns_names; | 55 std::vector<std::string> dns_names; |
| 56 | 56 |
| 57 // DER-encoded Name values (not including the Sequence tag). | 57 // DER-encoded Name values (not including the Sequence tag). |
| 58 std::vector<std::vector<uint8_t>> directory_names; | 58 std::vector<std::vector<uint8_t>> directory_names; |
| 59 | 59 |
| 60 // iPAddresses as sequences of octets in network byte order. This will be | 60 // iPAddresses as sequences of octets in network byte order. This will be |
| 61 // populated if the GeneralNames represents a Subject Alternative Name. | 61 // populated if the GeneralNames represents a Subject Alternative Name. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 77 class NET_EXPORT NameConstraints { | 77 class NET_EXPORT NameConstraints { |
| 78 public: | 78 public: |
| 79 | 79 |
| 80 ~NameConstraints(); | 80 ~NameConstraints(); |
| 81 | 81 |
| 82 // Parses a DER-encoded NameConstraints extension and initializes this object. | 82 // Parses a DER-encoded NameConstraints extension and initializes this object. |
| 83 // |extension_value| should be the extnValue from the extension (not including | 83 // |extension_value| should be the extnValue from the extension (not including |
| 84 // the OCTET STRING tag). |is_critical| should be true if the extension was | 84 // the OCTET STRING tag). |is_critical| should be true if the extension was |
| 85 // marked critical. Returns nullptr if parsing the the extension failed. | 85 // marked critical. Returns nullptr if parsing the the extension failed. |
| 86 // The object lifetime is not bound to the lifetime of |extension_value| data. | 86 // The object lifetime is not bound to the lifetime of |extension_value| data. |
| 87 static std::unique_ptr<NameConstraints> CreateFromDer( | 87 static std::unique_ptr<NameConstraints> Create( |
| 88 const der::Input& extension_value, | 88 const der::Input& extension_value, |
| 89 bool is_critical); | 89 bool is_critical); |
| 90 | 90 |
| 91 // Tests if a certificate is allowed by the name constraints. | 91 // Tests if a certificate is allowed by the name constraints. |
| 92 // |subject_rdn_sequence| should be the DER-encoded value of the subject's | 92 // |subject_rdn_sequence| should be the DER-encoded value of the subject's |
| 93 // RDNSequence (not including Sequence tag), and may be an empty ASN.1 | 93 // RDNSequence (not including Sequence tag), and may be an empty ASN.1 |
| 94 // sequence. |subject_alt_names| should be the parsed representation of the | 94 // sequence. |subject_alt_names| should be the parsed representation of the |
| 95 // subjectAltName extension or nullptr if the extension was not present. | 95 // subjectAltName extension or nullptr if the extension was not present. |
| 96 // Note that this method does not check hostname or IP address in commonName, | 96 // Note that this method does not check hostname or IP address in commonName, |
| 97 // which is deprecated (crbug.com/308330). | 97 // which is deprecated (crbug.com/308330). |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 bool Parse(const der::Input& extension_value, | 133 bool Parse(const der::Input& extension_value, |
| 134 bool is_critical) WARN_UNUSED_RESULT; | 134 bool is_critical) WARN_UNUSED_RESULT; |
| 135 | 135 |
| 136 GeneralNames permitted_subtrees_; | 136 GeneralNames permitted_subtrees_; |
| 137 GeneralNames excluded_subtrees_; | 137 GeneralNames excluded_subtrees_; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace net | 140 } // namespace net |
| 141 | 141 |
| 142 #endif // NET_CERT_INTERNAL_NAME_CONSTRAINTS_H_ | 142 #endif // NET_CERT_INTERNAL_NAME_CONSTRAINTS_H_ |
| OLD | NEW |