Index: net/base/openssl_private_key_store_memory.cc |
diff --git a/net/base/openssl_private_key_store_memory.cc b/net/base/openssl_private_key_store_memory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0bf00564ff1c6ec2fcb8329a6a6e67497e2fd3cd |
--- /dev/null |
+++ b/net/base/openssl_private_key_store_memory.cc |
@@ -0,0 +1,49 @@ |
+// Copyright (c) 2011 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. |
+ |
+// Defines an in-memory private key store, primarily used for testing. |
+ |
+#include "net/base/openssl_private_key_store.h" |
+ |
+#include "base/logging.h" |
+#include "base/memory/singleton.h" |
+#include "base/synchronization/lock.h" |
+#include "net/base/x509_certificate.h" |
+ |
+namespace net { |
+ |
+namespace { |
+ |
+// OpenSSLPrivateKeyStoreMemory is an OpenSSL private key store that |
+// does not make use of any Android APIs, making it suitable |
+// for use when using OpenSSL on non-Android platforms (eg: |
+// for testing purposes). |
+class OpenSSLPrivateKeyStoreMemory : public OpenSSLPrivateKeyStore { |
+ public: |
+ OpenSSLPrivateKeyStoreMemory() {} |
+ |
+ static OpenSSLPrivateKeyStoreMemory* GetInstance() { |
+ return Singleton<OpenSSLPrivateKeyStoreMemory>::get(); |
+ } |
+ |
+ virtual bool StoreKeyPair(const GURL& url, EVP_PKEY* pkey) OVERRIDE { |
+ // Since there is no real key store, just record the keys in |
+ // memory. |
+ AddKeyPair(pkey, pkey); |
+ return true; |
Ryan Sleevi
2013/02/25 19:51:07
DESIGN: This seems to violate what your base class
digit1
2013/02/26 11:03:13
Thanks, I've remove the AddKeyPair() entirely.
|
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(OpenSSLPrivateKeyStoreMemory); |
+}; |
+ |
+} // namespace |
+ |
+// static |
+OpenSSLPrivateKeyStore* OpenSSLPrivateKeyStore::GetInstance() { |
+ return OpenSSLPrivateKeyStoreMemory::GetInstance(); |
+} |
+ |
+} // namespace net |
+ |