Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: net/base/openssl_private_key_store.h

Issue 5594009: Adds first cut implementation of a private key store abstraction for openssl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ; Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/openssl_private_key_store.h
diff --git a/net/base/openssl_private_key_store.h b/net/base/openssl_private_key_store.h
new file mode 100644
index 0000000000000000000000000000000000000000..e95b8fe7f3ae8e49db2d6718b6772c4d3808d1e2
--- /dev/null
+++ b/net/base/openssl_private_key_store.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2010 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.
+
+#ifndef NET_BASE_OPENSSL_PRIVATE_KEY_STORE_H_
+#define NET_BASE_OPENSSL_PRIVATE_KEY_STORE_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+typedef struct evp_pkey_st EVP_PKEY;
+
+class GURL;
+
+namespace net {
+
+// Defines an abstract store for private keys; the OpenSSL library does not
+// provide this service so it is left to individual platforms to provide it.
+//
+// The contract is that the private key from will be stored in an
bulach 2010/12/08 20:37:00 s/from//
joth 2010/12/09 11:20:21 Done.
+// appropriately secure system location, and be available to the
+// SSLClientSocketOpenSSL when using a client certificate created against the
+// associated public key for client authentication.
+class OpenSSLPrivateKeyStore {
+ public:
+ // Platforms must define this factory function as appropriate.
+ static OpenSSLPrivateKeyStore* GetInstance();
+
+ virtual ~OpenSSLPrivateKeyStore() {}
+
+ // Called to store a private key generated via <keygen> while visiting |url|.
+ // Does not takes ownership of |pkey|, the caller reamins responsible to
+ // EVP_PKEY_free it. (Internally, a copy maybe made or the reference count
+ // incremented).
+ // Returns false if an error occurred whilst attempting to store the key.
+ virtual bool StorePrivateKey(const GURL& url, EVP_PKEY* pkey) = 0;
+
+ // Given a |public_key| part returns the corresponding private key, or NULL
+ // if no key found. Does NOT return ownership.
+ virtual EVP_PKEY* FetchPrivateKey(EVP_PKEY* public_key) = 0;
+
+ protected:
+ OpenSSLPrivateKeyStore() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OpenSSLPrivateKeyStore);
+};
+
+} // namespace net
+
+#endif // NET_BASE_OPENSSL_PRIVATE_KEY_STORE_H_

Powered by Google App Engine
This is Rietveld 408576698