| 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 #include "net/cert/internal/name_constraints.h" | 5 #include "net/cert/internal/name_constraints.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "net/cert/internal/verify_name_match.h" | 10 #include "net/cert/internal/verify_name_match.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 subtrees->dns_names.push_back(s); | 172 subtrees->dns_names.push_back(s); |
| 173 break; | 173 break; |
| 174 } | 174 } |
| 175 // x400Address [3] ORAddress, | 175 // x400Address [3] ORAddress, |
| 176 case 3: | 176 case 3: |
| 177 if (!der::IsConstructed(tag)) | 177 if (!der::IsConstructed(tag)) |
| 178 return false; | 178 return false; |
| 179 name_type = GENERAL_NAME_X400_ADDRESS; | 179 name_type = GENERAL_NAME_X400_ADDRESS; |
| 180 break; | 180 break; |
| 181 // directoryName [4] Name, | 181 // directoryName [4] Name, |
| 182 case 4: | 182 case 4: { |
| 183 if (!der::IsConstructed(tag)) | 183 if (!der::IsConstructed(tag)) |
| 184 return false; | 184 return false; |
| 185 name_type = GENERAL_NAME_DIRECTORY_NAME; | 185 name_type = GENERAL_NAME_DIRECTORY_NAME; |
| 186 subtrees->directory_names.push_back(std::vector<uint8_t>( | 186 // Name is a CHOICE { rdnSequence RDNSequence }, therefore the SEQUENCE |
| 187 value.UnsafeData(), value.UnsafeData() + value.Length())); | 187 // tag is explicit. Remove it, since the name matching functions expect |
| 188 // only the value portion. |
| 189 der::Parser name_parser(value); |
| 190 der::Input name_value; |
| 191 if (!name_parser.ReadTag(der::kSequence, &name_value) || parser.HasMore()) |
| 192 return false; |
| 193 subtrees->directory_names.push_back( |
| 194 std::vector<uint8_t>(name_value.UnsafeData(), |
| 195 name_value.UnsafeData() + name_value.Length())); |
| 188 break; | 196 break; |
| 197 } |
| 189 // ediPartyName [5] EDIPartyName, | 198 // ediPartyName [5] EDIPartyName, |
| 190 case 5: | 199 case 5: |
| 191 if (!der::IsConstructed(tag)) | 200 if (!der::IsConstructed(tag)) |
| 192 return false; | 201 return false; |
| 193 name_type = GENERAL_NAME_EDI_PARTY_NAME; | 202 name_type = GENERAL_NAME_EDI_PARTY_NAME; |
| 194 break; | 203 break; |
| 195 // uniformResourceIdentifier [6] IA5String, | 204 // uniformResourceIdentifier [6] IA5String, |
| 196 case 6: | 205 case 6: |
| 197 if (der::IsConstructed(tag)) | 206 if (der::IsConstructed(tag)) |
| 198 return false; | 207 return false; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 | 573 |
| 565 return false; | 574 return false; |
| 566 } | 575 } |
| 567 | 576 |
| 568 int NameConstraints::ConstrainedNameTypes() const { | 577 int NameConstraints::ConstrainedNameTypes() const { |
| 569 return (permitted_subtrees_.present_name_types | | 578 return (permitted_subtrees_.present_name_types | |
| 570 excluded_subtrees_.present_name_types); | 579 excluded_subtrees_.present_name_types); |
| 571 } | 580 } |
| 572 | 581 |
| 573 } // namespace net | 582 } // namespace net |
| OLD | NEW |