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

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

Issue 2903633005: Add generated PKITS tests relating to certificate policies. (Closed)
Patch Set: Created 3 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/cert/internal/nist_pkits_unittest.h"
6
7 #include "net/cert/internal/certificate_policies.h"
8
9 namespace net {
10
11 namespace {
12
13 // 2.16.840.1.101.3.2.1.48.1
14 const uint8_t kTestPolicy1[] = {0x60, 0x86, 0x48, 0x01, 0x65,
15 0x03, 0x02, 0x01, 0x30, 0x01};
16
17 // 2.16.840.1.101.3.2.1.48.2
18 const uint8_t kTestPolicy2[] = {0x60, 0x86, 0x48, 0x01, 0x65,
19 0x03, 0x02, 0x01, 0x30, 0x02};
20
21 // 2.16.840.1.101.3.2.1.48.3
22 const uint8_t kTestPolicy3[] = {0x60, 0x86, 0x48, 0x01, 0x65,
23 0x03, 0x02, 0x01, 0x30, 0x03};
24
25 // 2.16.840.1.101.3.2.1.48.6
26 const uint8_t kTestPolicy6[] = {0x60, 0x86, 0x48, 0x01, 0x65,
27 0x03, 0x02, 0x01, 0x30, 0x06};
28
29 } // namespace
30
31 PkitsTestSettings::PkitsTestSettings() {
32 SetInitialPolicySet("anyPolicy");
33 }
34
35 PkitsTestSettings::~PkitsTestSettings() = default;
36
37 void PkitsTestSettings::SetInitialPolicySet(const char* const policy_names) {
38 initial_policy_set.clear();
39 std::vector<std::string> names = base::SplitString(
40 policy_names, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
41 for (const std::string& policy_name : names) {
42 if (policy_name == "anyPolicy") {
43 initial_policy_set.insert(AnyPolicy());
44 } else if (policy_name == "NIST-test-policy-1") {
45 initial_policy_set.insert(der::Input(kTestPolicy1));
46 } else if (policy_name == "NIST-test-policy-2") {
47 initial_policy_set.insert(der::Input(kTestPolicy2));
48 } else if (policy_name == "NIST-test-policy-3") {
49 initial_policy_set.insert(der::Input(kTestPolicy3));
50 } else if (policy_name == "NIST-test-policy-6") {
51 initial_policy_set.insert(der::Input(kTestPolicy6));
52 } else {
53 ADD_FAILURE() << "Unknown policy name: " << policy_name;
54 }
55 }
56 }
57
58 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698