| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // guarantees they are all zero. | 143 // guarantees they are all zero. |
| 144 for (size_t i = 0; i < bits.bytes().Length(); ++i) { | 144 for (size_t i = 0; i < bits.bytes().Length(); ++i) { |
| 145 if (bits.bytes().UnsafeData()[i] != 0) | 145 if (bits.bytes().UnsafeData()[i] != 0) |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 | 152 |
| 153 ParsedCertificate::ParsedCertificate() {} |
| 154 |
| 155 ParsedCertificate::~ParsedCertificate() {} |
| 156 |
| 153 ParsedTbsCertificate::ParsedTbsCertificate() {} | 157 ParsedTbsCertificate::ParsedTbsCertificate() {} |
| 154 | 158 |
| 155 ParsedTbsCertificate::~ParsedTbsCertificate() {} | 159 ParsedTbsCertificate::~ParsedTbsCertificate() {} |
| 156 | 160 |
| 157 bool VerifySerialNumber(const der::Input& value) { | 161 bool VerifySerialNumber(const der::Input& value) { |
| 158 bool unused_negative; | 162 bool unused_negative; |
| 159 if (!der::IsValidInteger(value, &unused_negative)) | 163 if (!der::IsValidInteger(value, &unused_negative)) |
| 160 return false; | 164 return false; |
| 161 | 165 |
| 162 // Check if the serial number is too long per RFC 5280. | 166 // Check if the serial number is too long per RFC 5280. |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // | 573 // |
| 570 // When the keyUsage extension appears in a certificate, at least | 574 // When the keyUsage extension appears in a certificate, at least |
| 571 // one of the bits MUST be set to 1. | 575 // one of the bits MUST be set to 1. |
| 572 if (BitStringIsAllZeros(*key_usage)) | 576 if (BitStringIsAllZeros(*key_usage)) |
| 573 return false; | 577 return false; |
| 574 | 578 |
| 575 return true; | 579 return true; |
| 576 } | 580 } |
| 577 | 581 |
| 578 } // namespace net | 582 } // namespace net |
| OLD | NEW |