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