forked from Igalia/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_cert_identity_mac.cc
32 lines (24 loc) · 1.06 KB
/
client_cert_identity_mac.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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