Chromium Code Reviews| 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 // Since there is no real key store, just record the keys in | |
| 32 // memory. | |
| 33 AddKeyPair(pkey, pkey); | |
| 34 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.
| |
| 35 } | |
| 36 | |
| 37 private: | |
| 38 DISALLOW_COPY_AND_ASSIGN(OpenSSLPrivateKeyStoreMemory); | |
| 39 }; | |
| 40 | |
| 41 } // namespace | |
| 42 | |
| 43 // static | |
| 44 OpenSSLPrivateKeyStore* OpenSSLPrivateKeyStore::GetInstance() { | |
| 45 return OpenSSLPrivateKeyStoreMemory::GetInstance(); | |
| 46 } | |
| 47 | |
| 48 } // namespace net | |
| 49 | |
| OLD | NEW |