Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1085)

Side by Side Diff: net/cert/internal/parsed_certificate_unittest.cc

Issue 2870323002: Add parsing for RFC 5280's InhibitAnyPolicy. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/parsed_certificate.h" 5 #include "net/cert/internal/parsed_certificate.h"
6 6
7 #include "net/cert/internal/cert_errors.h" 7 #include "net/cert/internal/cert_errors.h"
8 #include "net/cert/internal/parse_certificate.h" 8 #include "net/cert/internal/parse_certificate.h"
9 #include "net/cert/internal/test_helpers.h" 9 #include "net/cert/internal/test_helpers.h"
10 #include "net/der/input.h" 10 #include "net/der/input.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 ASSERT_TRUE(cert); 418 ASSERT_TRUE(cert);
419 419
420 static const uint8_t expected_serial[37] = { 420 static const uint8_t expected_serial[37] = {
421 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 421 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
422 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 422 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14,
423 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 423 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e,
424 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25}; 424 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25};
425 EXPECT_EQ(der::Input(expected_serial), cert->tbs().serial_number); 425 EXPECT_EQ(der::Input(expected_serial), cert->tbs().serial_number);
426 } 426 }
427 427
428 // Tests parsing a certificate that has an inhibitAnyPolicy extension.
429 TEST(ParsedCertificateTest, InhibitAnyPolicy) {
430 scoped_refptr<ParsedCertificate> cert =
431 ParseCertificateFromFile("inhibit_any_policy.pem", {});
432 ASSERT_TRUE(cert);
433
434 ParsedExtension extension;
435 ASSERT_TRUE(cert->GetExtension(InhibitAnyPolicyOid(), &extension));
436
437 uint8_t skip_count;
438 ASSERT_TRUE(ParseInhibitAnyPolicy(extension.value, &skip_count));
439 EXPECT_EQ(3, skip_count);
440 }
441
428 } // namespace 442 } // namespace
429 443
430 } // namespace net 444 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/certificate_policies_unittest.cc ('k') | net/data/parse_certificate_unittest/inhibit_any_policy.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698