Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 | #ifndef SHILL_NSS_ |
| 6 | #define SHILL_NSS_ |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include <base/file_path.h> |
| 12 | #include <base/lazy_instance.h> |
| 13 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 14 | |
| 15 | namespace shill { |
| 16 | |
Jorge Lucangeli Obes | ccd5c85 | 2012-12-19 18:08:40 -0800 | [diff] [blame] | 17 | class Minijail; |
Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 18 | |
| 19 | class NSS { |
| 20 | public: |
| 21 | virtual ~NSS(); |
| 22 | |
| 23 | // This is a singleton -- use NSS::GetInstance()->Foo() |
| 24 | static NSS *GetInstance(); |
| 25 | |
Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 26 | // Returns an empty path on failure. |
Albert Chaulk | 0e1cdea | 2013-02-27 15:32:55 -0800 | [diff] [blame] | 27 | virtual base::FilePath GetPEMCertfile(const std::string &nickname, |
| 28 | const std::vector<char> &id); |
Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 29 | |
| 30 | // Returns an empty path on failure. |
Albert Chaulk | 0e1cdea | 2013-02-27 15:32:55 -0800 | [diff] [blame] | 31 | virtual base::FilePath GetDERCertfile(const std::string &nickname, |
| 32 | const std::vector<char> &id); |
Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 33 | |
| 34 | protected: |
| 35 | NSS(); |
| 36 | |
| 37 | private: |
| 38 | friend struct base::DefaultLazyInstanceTraits<NSS>; |
| 39 | friend class NSSTest; |
| 40 | FRIEND_TEST(NSSTest, GetCertfile); |
| 41 | |
Albert Chaulk | 0e1cdea | 2013-02-27 15:32:55 -0800 | [diff] [blame] | 42 | base::FilePath GetCertfile(const std::string &nickname, |
| 43 | const std::vector<char> &id, |
| 44 | const std::string &type); |
Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 45 | |
Jorge Lucangeli Obes | ccd5c85 | 2012-12-19 18:08:40 -0800 | [diff] [blame] | 46 | Minijail *minijail_; |
Darin Petkov | 3c5e4dc | 2012-04-02 14:44:27 +0200 | [diff] [blame] | 47 | |
| 48 | DISALLOW_COPY_AND_ASSIGN(NSS); |
| 49 | }; |
| 50 | |
| 51 | } // namespace shill |
| 52 | |
| 53 | #endif // SHILL_NSS_ |