mattm | 436ccfe | 2017-06-19 20:24:08 | [diff] [blame] | 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_mac.h" |
| 6 | |
| 7 | #include "net/ssl/ssl_platform_key_mac.h" |
| 8 | #include "net/ssl/ssl_private_key.h" |
| 9 | |
| 10 | namespace net { |
| 11 | |
| 12 | ClientCertIdentityMac::ClientCertIdentityMac( |
| 13 | scoped_refptr<net::X509Certificate> cert, |
| 14 | base::ScopedCFTypeRef<SecIdentityRef> sec_identity) |
| 15 | : ClientCertIdentity(std::move(cert)), identity_(std::move(sec_identity)) {} |
| 16 | |
| 17 | ClientCertIdentityMac::~ClientCertIdentityMac() = default; |
| 18 | |
| 19 | void ClientCertIdentityMac::AcquirePrivateKey( |
David Benjamin | 0cda204 | 2019-04-08 23:00:58 | [diff] [blame] | 20 | base::OnceCallback<void(scoped_refptr<SSLPrivateKey>)> |
mattm | 436ccfe | 2017-06-19 20:24:08 | [diff] [blame] | 21 | private_key_callback) { |
| 22 | // This only adds a ref to and returns the private key from identity_ so it |
| 23 | // doesn't need to run on a worker thread. |
David Benjamin | 0cda204 | 2019-04-08 23:00:58 | [diff] [blame] | 24 | std::move(private_key_callback) |
| 25 | .Run(CreateSSLPrivateKeyForSecIdentity(certificate(), identity_.get())); |
mattm | 436ccfe | 2017-06-19 20:24:08 | [diff] [blame] | 26 | } |
| 27 | |
mattm | 436ccfe | 2017-06-19 20:24:08 | [diff] [blame] | 28 | } // namespace net |