| 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 "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "net/cert/internal/test_helpers.h" | 8 #include "net/cert/internal/test_helpers.h" |
| 9 #include "net/der/input.h" | 9 #include "net/der/input.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // CAs are not supposed to include negative serial numbers, however RFC 5280 | 213 // CAs are not supposed to include negative serial numbers, however RFC 5280 |
| 214 // expects consumers to deal with it anyway). | 214 // expects consumers to deal with it anyway). |
| 215 TEST(ParseTbsCertificateTest, NegativeSerialNumber) { | 215 TEST(ParseTbsCertificateTest, NegativeSerialNumber) { |
| 216 EnsureParsingTbsSucceeds("tbs_negative_serial_number.pem", | 216 EnsureParsingTbsSucceeds("tbs_negative_serial_number.pem", |
| 217 CertificateVersion::V3); | 217 CertificateVersion::V3); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Tests parsing a TBSCertificate with a serial number that is 21 octets long | 220 // Tests parsing a TBSCertificate with a serial number that is 21 octets long |
| 221 // (and the first byte is 0). | 221 // (and the first byte is 0). |
| 222 TEST(ParseTbCertificateTest, SerialNumber21OctetsLeading0) { | 222 TEST(ParseTbCertificateTest, SerialNumber21OctetsLeading0) { |
| 223 EnsureParsingTbsFails("tbs_serial_number_21_octets_leading_0.pem"); | 223 EnsureParsingTbsSucceeds("tbs_serial_number_21_octets_leading_0.pem", |
| 224 CertificateVersion::V3); |
| 224 } | 225 } |
| 225 | 226 |
| 226 // Tests parsing a TBSCertificate with a serial number that is 26 octets long | 227 // Tests parsing a TBSCertificate with a serial number that is 26 octets long |
| 227 // (and does not contain a leading 0). | 228 // (and does not contain a leading 0). |
| 228 TEST(ParseTbsCertificateTest, SerialNumber26Octets) { | 229 TEST(ParseTbsCertificateTest, SerialNumber26Octets) { |
| 229 EnsureParsingTbsFails("tbs_serial_number_26_octets.pem"); | 230 EnsureParsingTbsFails("tbs_serial_number_26_octets.pem"); |
| 230 } | 231 } |
| 231 | 232 |
| 232 // Tests parsing a TBSCertificate which lacks a version number (causing it to | 233 // Tests parsing a TBSCertificate which lacks a version number (causing it to |
| 233 // default to v1). | 234 // default to v1). |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 0x00, // Number of unused bits | 782 0x00, // Number of unused bits |
| 782 }; | 783 }; |
| 783 | 784 |
| 784 der::BitString key_usage; | 785 der::BitString key_usage; |
| 785 ASSERT_FALSE(ParseKeyUsage(der::Input(der), &key_usage)); | 786 ASSERT_FALSE(ParseKeyUsage(der::Input(der), &key_usage)); |
| 786 } | 787 } |
| 787 | 788 |
| 788 } // namespace | 789 } // namespace |
| 789 | 790 |
| 790 } // namespace net | 791 } // namespace net |
| OLD | NEW |