OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 // Defines an in-memory private key store, primarily used for testing. |
| 6 |
| 7 #include "net/base/openssl_private_key_store.h" |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/memory/singleton.h" |
| 11 #include "base/synchronization/lock.h" |
| 12 #include "net/base/x509_certificate.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 namespace { |
| 17 |
| 18 // OpenSSLPrivateKeyStoreMemory is an OpenSSL private key store that |
| 19 // does not make use of any Android APIs, making it suitable |
| 20 // for use when using OpenSSL on non-Android platforms (eg: |
| 21 // for testing purposes). |
| 22 class OpenSSLPrivateKeyStoreMemory : public OpenSSLPrivateKeyStore { |
| 23 public: |
| 24 OpenSSLPrivateKeyStoreMemory() {} |
| 25 |
| 26 static OpenSSLPrivateKeyStoreMemory* GetInstance() { |
| 27 return Singleton<OpenSSLPrivateKeyStoreMemory>::get(); |
| 28 } |
| 29 |
| 30 virtual bool StoreKeyPair(const GURL& url, EVP_PKEY* pkey) OVERRIDE { |
| 31 // There is no key store here, so don't do anything. |
| 32 return true; |
| 33 } |
| 34 |
| 35 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(OpenSSLPrivateKeyStoreMemory); |
| 37 }; |
| 38 |
| 39 } // namespace |
| 40 |
| 41 // static |
| 42 OpenSSLPrivateKeyStore* OpenSSLPrivateKeyStore::GetInstance() { |
| 43 return OpenSSLPrivateKeyStoreMemory::GetInstance(); |
| 44 } |
| 45 |
| 46 } // namespace net |
| 47 |
OLD | NEW |