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/parse_certificate.h" | 5 #include "net/cert/internal/parse_certificate.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "net/der/input.h" | 9 #include "net/der/input.h" |
10 #include "net/der/parse_values.h" | 10 #include "net/der/parse_values.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 501 } |
502 | 502 |
503 // By definition the input was a single Extensions sequence, so there | 503 // By definition the input was a single Extensions sequence, so there |
504 // shouldn't be unconsumed data. | 504 // shouldn't be unconsumed data. |
505 if (parser.HasMore()) | 505 if (parser.HasMore()) |
506 return false; | 506 return false; |
507 | 507 |
508 return true; | 508 return true; |
509 } | 509 } |
510 | 510 |
| 511 NET_EXPORT bool ConsumeExtension( |
| 512 const der::Input& oid, |
| 513 std::map<der::Input, ParsedExtension>* unconsumed_extensions, |
| 514 ParsedExtension* extension) { |
| 515 auto it = unconsumed_extensions->find(oid); |
| 516 if (it == unconsumed_extensions->end()) |
| 517 return false; |
| 518 |
| 519 *extension = it->second; |
| 520 unconsumed_extensions->erase(it); |
| 521 return true; |
| 522 } |
| 523 |
511 bool ParseBasicConstraints(const der::Input& basic_constraints_tlv, | 524 bool ParseBasicConstraints(const der::Input& basic_constraints_tlv, |
512 ParsedBasicConstraints* out) { | 525 ParsedBasicConstraints* out) { |
513 der::Parser parser(basic_constraints_tlv); | 526 der::Parser parser(basic_constraints_tlv); |
514 | 527 |
515 // BasicConstraints ::= SEQUENCE { | 528 // BasicConstraints ::= SEQUENCE { |
516 der::Parser sequence_parser; | 529 der::Parser sequence_parser; |
517 if (!parser.ReadSequence(&sequence_parser)) | 530 if (!parser.ReadSequence(&sequence_parser)) |
518 return false; | 531 return false; |
519 | 532 |
520 // cA BOOLEAN DEFAULT FALSE, | 533 // cA BOOLEAN DEFAULT FALSE, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // | 584 // |
572 // When the keyUsage extension appears in a certificate, at least | 585 // When the keyUsage extension appears in a certificate, at least |
573 // one of the bits MUST be set to 1. | 586 // one of the bits MUST be set to 1. |
574 if (BitStringIsAllZeros(*key_usage)) | 587 if (BitStringIsAllZeros(*key_usage)) |
575 return false; | 588 return false; |
576 | 589 |
577 return true; | 590 return true; |
578 } | 591 } |
579 | 592 |
580 } // namespace net | 593 } // namespace net |
OLD | NEW |