| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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 #ifndef NET_BASE_OPENSSL_PRIVATE_KEY_STORE_H_ | |
| 6 #define NET_BASE_OPENSSL_PRIVATE_KEY_STORE_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 // Avoid including <openssl/evp.h> | |
| 11 typedef struct evp_pkey_st EVP_PKEY; | |
| 12 | |
| 13 #include "base/macros.h" | |
| 14 #include "net/base/net_export.h" | |
| 15 | |
| 16 class GURL; | |
| 17 | |
| 18 namespace net { | |
| 19 | |
| 20 // OpenSSLPrivateKeyStore provides an interface for storing | |
| 21 // public/private key pairs to system storage on platforms where | |
| 22 // OpenSSL is used. | |
| 23 // This class shall only be used from the network thread. | |
| 24 class NET_EXPORT OpenSSLPrivateKeyStore { | |
| 25 public: | |
| 26 // Called to permanently store a private/public key pair, generated | |
| 27 // via <keygen> while visiting |url|, to an appropriate system | |
| 28 // location. Increments |pkey|'s reference count, so the caller is still | |
| 29 // responsible for calling EVP_PKEY_free on it. | |
| 30 // |url| is the corresponding server URL. | |
| 31 // |pkey| is the key pair handle. | |
| 32 // Returns false if an error occurred whilst attempting to store the key. | |
| 33 static bool StoreKeyPair(const GURL& url, EVP_PKEY* pkey); | |
| 34 | |
| 35 // Checks that the private key for a given public key is installed. | |
| 36 // |pub_key| a public key. | |
| 37 // Returns true if there is a private key that was previously | |
| 38 // recorded through StoreKeyPair(). | |
| 39 // NOTE: Intentionally not implemented on Android because there is no | |
| 40 // platform API that can perform this operation silently. | |
| 41 static bool HasPrivateKey(EVP_PKEY* pub_key); | |
| 42 | |
| 43 private: | |
| 44 OpenSSLPrivateKeyStore(); // not implemented. | |
| 45 ~OpenSSLPrivateKeyStore(); // not implemented. | |
| 46 DISALLOW_COPY_AND_ASSIGN(OpenSSLPrivateKeyStore); | |
| 47 }; | |
| 48 | |
| 49 } // namespace net | |
| 50 | |
| 51 #endif // NET_BASE_OPENSSL_PRIVATE_KEY_STORE_H_ | |
| OLD | NEW |