| Index: net/ssl/openssl_client_key_store.h
|
| diff --git a/net/ssl/openssl_client_key_store.h b/net/ssl/openssl_client_key_store.h
|
| index 63559ded766f493d57eb7de693ff0272d40c3231..9e1e1f4202d80111459c226c4d772fd344fa9024 100644
|
| --- a/net/ssl/openssl_client_key_store.h
|
| +++ b/net/ssl/openssl_client_key_store.h
|
| @@ -5,19 +5,19 @@
|
| #ifndef NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_
|
| #define NET_SSL_OPENSSL_CLIENT_KEY_STORE_H_
|
|
|
| -#include <openssl/evp.h>
|
| +#include <openssl/base.h>
|
|
|
| -#include <memory>
|
| -#include <vector>
|
| +#include <map>
|
| +#include <string>
|
|
|
| #include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/memory/singleton.h"
|
| -#include "crypto/openssl_util.h"
|
| -#include "crypto/scoped_openssl_types.h"
|
| #include "net/base/net_export.h"
|
|
|
| namespace net {
|
|
|
| +class SSLPrivateKey;
|
| class X509Certificate;
|
|
|
| // OpenSSLClientKeyStore implements an in-memory store for client
|
| @@ -38,57 +38,29 @@ class NET_EXPORT OpenSSLClientKeyStore {
|
| // when it is called later. The association is recorded in memory
|
| // exclusively.
|
| // |cert| is a handle to a certificate object.
|
| - // |private_key| is an OpenSSL EVP_PKEY that corresponds to the
|
| - // certificate's private key.
|
| + // |private_key| is an SSLPrivateKey that corresponds to the certificate's
|
| + // private key.
|
| // Returns false if an error occured.
|
| - // This function does not take ownership of the private_key, but may
|
| - // increment its internal reference count.
|
| bool RecordClientCertPrivateKey(const X509Certificate* cert,
|
| - EVP_PKEY* private_key);
|
| + scoped_refptr<SSLPrivateKey> key);
|
|
|
| // Given a certificate's |public_key|, return the corresponding private
|
| // key that has been recorded previously by RecordClientCertPrivateKey().
|
| // |cert| is a client certificate.
|
| // Returns its matching private key on success, NULL otherwise.
|
| - crypto::ScopedEVP_PKEY FetchClientCertPrivateKey(const X509Certificate* cert);
|
| + scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey(
|
| + const X509Certificate* cert);
|
|
|
| // Flush all recorded keys.
|
| void Flush();
|
|
|
| - protected:
|
| + private:
|
| OpenSSLClientKeyStore();
|
| -
|
| ~OpenSSLClientKeyStore();
|
|
|
| - // Adds a given public/private key pair.
|
| - // |pub_key| and |private_key| can point to the same object.
|
| - // This increments the reference count on both objects, caller
|
| - // must still call EVP_PKEY_free on them.
|
| - void AddKeyPair(EVP_PKEY* pub_key, EVP_PKEY* private_key);
|
| -
|
| - private:
|
| - // KeyPair is an internal class used to hold a pair of private / public
|
| - // EVP_PKEY objects, with appropriate ownership.
|
| - class KeyPair {
|
| - public:
|
| - explicit KeyPair(EVP_PKEY* pub_key, EVP_PKEY* priv_key);
|
| - KeyPair(const KeyPair& other);
|
| - // Intentionally pass by value, in order to use the copy-and-swap idiom.
|
| - void operator=(KeyPair other);
|
| - void swap(KeyPair& other);
|
| - ~KeyPair();
|
| -
|
| - crypto::ScopedEVP_PKEY public_key;
|
| - crypto::ScopedEVP_PKEY private_key;
|
| -
|
| - private:
|
| - KeyPair(); // intentionally not implemented.
|
| - };
|
| -
|
| - // Returns the index of the keypair for |public_key|. or -1 if not found.
|
| - int FindKeyPairIndex(EVP_PKEY* public_key);
|
| -
|
| - std::vector<KeyPair> pairs_;
|
| + // Maps from the serialized SubjectPublicKeyInfo structure to the
|
| + // corresponding private key.
|
| + std::map<std::string, scoped_refptr<net::SSLPrivateKey>> key_map_;
|
|
|
| friend struct base::DefaultSingletonTraits<OpenSSLClientKeyStore>;
|
|
|
|
|