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

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

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: rebase on https://codereview.chromium.org/2899083006/ 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
« no previous file with comments | « net/ssl/client_cert_identity_test_util.h ('k') | net/ssl/client_cert_identity_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ssl/client_cert_identity_test_util.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "net/ssl/ssl_private_key.h"
9
10 namespace net {
11
12 FakeClientCertIdentity::FakeClientCertIdentity(
13 scoped_refptr<X509Certificate> cert)
14 : ClientCertIdentity(std::move(cert)) {}
15
16 FakeClientCertIdentity::FakeClientCertIdentity(
17 scoped_refptr<X509Certificate> cert,
18 scoped_refptr<SSLPrivateKey> key)
19 : ClientCertIdentity(std::move(cert)), key_(std::move(key)) {}
20
21 FakeClientCertIdentity::~FakeClientCertIdentity() = default;
22
23 void FakeClientCertIdentity::AcquirePrivateKey(
24 const base::Callback<void(scoped_refptr<SSLPrivateKey>)>&
25 private_key_callback) {
26 private_key_callback.Run(key_);
27 }
28
29 #if defined(OS_MACOSX)
30 SecIdentityRef FakeClientCertIdentity::sec_identity_ref() const {
31 NOTREACHED();
32 return nullptr;
33 }
34 #endif
35
36 ClientCertIdentityList FakeClientCertIdentityListFromCertificateList(
37 const CertificateList& certs) {
38 ClientCertIdentityList result;
39 for (const auto& cert : certs) {
40 result.push_back(base::MakeUnique<FakeClientCertIdentity>(cert));
41 }
42 return result;
43 }
44
45 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/client_cert_identity_test_util.h ('k') | net/ssl/client_cert_identity_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698