Move pending tile priorities to active on tree activation
[chromium-blink-merge.git] / net / base / openssl_private_key_store.h
blobec7964687f427a526f2f49676f51a3804d4abcf3
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 "base/basictypes.h"
10 typedef struct evp_pkey_st EVP_PKEY;
12 class GURL;
14 namespace net {
16 // Defines an abstract store for private keys; the OpenSSL library does not
17 // provide this service so it is left to individual platforms to provide it.
19 // The contract is that the private key will be stored in an appropriate secure
20 // system location, and be available to the SSLClientSocketOpenSSL when using a
21 // client certificate created against the associated public key for client
22 // authentication.
23 class OpenSSLPrivateKeyStore {
24 public:
25 // Platforms must define this factory function as appropriate.
26 static OpenSSLPrivateKeyStore* GetInstance();
28 virtual ~OpenSSLPrivateKeyStore() {}
30 // Called to store a private key generated via <keygen> while visiting |url|.
31 // Does not takes ownership of |pkey|, the caller reamins responsible to
32 // EVP_PKEY_free it. (Internally, a copy maybe made or the reference count
33 // incremented).
34 // Returns false if an error occurred whilst attempting to store the key.
35 virtual bool StorePrivateKey(const GURL& url, EVP_PKEY* pkey) = 0;
37 // Given a |public_key| part returns the corresponding private key, or NULL
38 // if no key found. Does NOT return ownership.
39 virtual EVP_PKEY* FetchPrivateKey(EVP_PKEY* public_key) = 0;
41 protected:
42 OpenSSLPrivateKeyStore() {}
44 private:
45 DISALLOW_COPY_AND_ASSIGN(OpenSSLPrivateKeyStore);
48 } // namespace net
50 #endif // NET_BASE_OPENSSL_PRIVATE_KEY_STORE_H_