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

Unified Diff: net/ssl/client_cert_identity_mac.cc

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: removed no longer needed forward declaration 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ssl/client_cert_identity_mac.h ('k') | net/ssl/client_cert_identity_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/client_cert_identity_mac.cc
diff --git a/net/ssl/client_cert_identity_mac.cc b/net/ssl/client_cert_identity_mac.cc
new file mode 100644
index 0000000000000000000000000000000000000000..34c271564545fa228e6a644dca3092a7a0bc7ea3
--- /dev/null
+++ b/net/ssl/client_cert_identity_mac.cc
@@ -0,0 +1,32 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/ssl/client_cert_identity_mac.h"
+
+#include "net/ssl/ssl_platform_key_mac.h"
+#include "net/ssl/ssl_private_key.h"
+
+namespace net {
+
+ClientCertIdentityMac::ClientCertIdentityMac(
+ scoped_refptr<net::X509Certificate> cert,
+ base::ScopedCFTypeRef<SecIdentityRef> sec_identity)
+ : ClientCertIdentity(std::move(cert)), identity_(std::move(sec_identity)) {}
+
+ClientCertIdentityMac::~ClientCertIdentityMac() = default;
+
+void ClientCertIdentityMac::AcquirePrivateKey(
+ const base::Callback<void(scoped_refptr<SSLPrivateKey>)>&
+ private_key_callback) {
+ // This only adds a ref to and returns the private key from identity_ so it
+ // doesn't need to run on a worker thread.
+ private_key_callback.Run(
+ CreateSSLPrivateKeyForSecIdentity(certificate(), identity_.get()));
+}
+
+SecIdentityRef ClientCertIdentityMac::sec_identity_ref() const {
+ return identity_.get();
+}
+
+} // namespace net
« no previous file with comments | « net/ssl/client_cert_identity_mac.h ('k') | net/ssl/client_cert_identity_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698