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

Side by Side Diff: net/ssl/client_cert_store_impl_unittest.cc

Issue 13866049: Fix client certificate authentication on Mac and Linux introduced in r178732 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refresh key files for certs Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/ssl/client_cert_store_impl_nss.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ssl/client_cert_store_impl.h" 5 #include "net/ssl/client_cert_store_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "net/base/test_data_directory.h" 13 #include "net/base/test_data_directory.h"
14 #include "net/test/cert_test_util.h" 14 #include "net/test/cert_test_util.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 namespace { 19 namespace {
20 20
21 // "CN=Client Auth Test Root 1" - DER encoded DN of the issuer of client_1.pem. 21 // "CN=B CA" - DER encoded DN of the issuer of client_1.pem
22 const unsigned char kAuthority1DN[] = { 22 const unsigned char kAuthority1DN[] = {
23 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 23 0x30, 0x0f, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
24 0x17, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 24 0x04, 0x42, 0x20, 0x43, 0x41
25 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x31
26 }; 25 };
27 26
28 // "CN=Client Auth Test Root 2" - DER encoded DN of the issuer of client_2.pem. 27 // "CN=E CA" - DER encoded DN of the issuer of client_2.pem
29 unsigned char kAuthority2DN[] = { 28 unsigned char kAuthority2DN[] = {
30 0x30, 0x22, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 29 0x30, 0x0f, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
31 0x17, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 30 0x04, 0x45, 0x20, 0x43, 0x41
32 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x32
33 }; 31 };
34 32
35 } // namespace 33 } // namespace
36 34
37 TEST(ClientCertStoreImplTest, EmptyQuery) { 35 TEST(ClientCertStoreImplTest, EmptyQuery) {
38 std::vector<scoped_refptr<X509Certificate> > certs; 36 std::vector<scoped_refptr<X509Certificate> > certs;
39 scoped_refptr<SSLCertRequestInfo> request(new SSLCertRequestInfo()); 37 scoped_refptr<SSLCertRequestInfo> request(new SSLCertRequestInfo());
40 38
41 ClientCertStoreImpl store; 39 ClientCertStoreImpl store;
42 std::vector<scoped_refptr<X509Certificate> > selected_certs; 40 std::vector<scoped_refptr<X509Certificate> > selected_certs;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool rv = store.SelectClientCertsGivenPreferred(cert_1, certs, *request, 141 bool rv = store.SelectClientCertsGivenPreferred(cert_1, certs, *request,
144 &selected_certs); 142 &selected_certs);
145 EXPECT_TRUE(rv); 143 EXPECT_TRUE(rv);
146 ASSERT_EQ(2u, selected_certs.size()); 144 ASSERT_EQ(2u, selected_certs.size());
147 EXPECT_TRUE(selected_certs[0]->Equals(cert_1)); 145 EXPECT_TRUE(selected_certs[0]->Equals(cert_1));
148 EXPECT_TRUE(selected_certs[1]->Equals(cert_2)); 146 EXPECT_TRUE(selected_certs[1]->Equals(cert_2));
149 } 147 }
150 #endif 148 #endif
151 149
152 } // namespace net 150 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/client_cert_store_impl_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698