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..ed40d2efe38abfbde5cb4efc1d183c0073fc84b9 |
--- /dev/null |
+++ b/net/base/openssl_private_key_store_memory.cc |
@@ -0,0 +1,47 @@ |
+// 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 { |
+ // There is no key store here, so don't do anything. |
+ return true; |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(OpenSSLPrivateKeyStoreMemory); |
+}; |
+ |
+} // namespace |
+ |
+// static |
+OpenSSLPrivateKeyStore* OpenSSLPrivateKeyStore::GetInstance() { |
+ return OpenSSLPrivateKeyStoreMemory::GetInstance(); |
+} |
+ |
+} // namespace net |
+ |