blob: 143297ca4dea0097e3e666b3cadc63a7f6347189 [file] [log] [blame]
mattm436ccfe2017-06-19 20:24:081// 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
10namespace net {
11
12ClientCertIdentityMac::ClientCertIdentityMac(
13 scoped_refptr<net::X509Certificate> cert,
14 base::ScopedCFTypeRef<SecIdentityRef> sec_identity)
15 : ClientCertIdentity(std::move(cert)), identity_(std::move(sec_identity)) {}
16
17ClientCertIdentityMac::~ClientCertIdentityMac() = default;
18
19void ClientCertIdentityMac::AcquirePrivateKey(
David Benjamin0cda2042019-04-08 23:00:5820 base::OnceCallback<void(scoped_refptr<SSLPrivateKey>)>
mattm436ccfe2017-06-19 20:24:0821 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 Benjamin0cda2042019-04-08 23:00:5824 std::move(private_key_callback)
25 .Run(CreateSSLPrivateKeyForSecIdentity(certificate(), identity_.get()));
mattm436ccfe2017-06-19 20:24:0826}
27
mattm436ccfe2017-06-19 20:24:0828} // namespace net