blob: 4b0b1d6d961ef261c5511e8d38180d5ebc86ca29 [file] [log] [blame]
Darin Petkov3c5e4dc2012-04-02 14:44:27 +02001// 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
Ben Chana0ddf462014-02-06 11:32:42 -080011#include <base/files/file_path.h>
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020012#include <base/lazy_instance.h>
13#include <gtest/gtest_prod.h> // for FRIEND_TEST
14
15namespace shill {
16
Jorge Lucangeli Obesccd5c852012-12-19 18:08:40 -080017class Minijail;
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020018
19class NSS {
20 public:
21 virtual ~NSS();
22
mukesh agrawalf407d592013-07-31 11:37:57 -070023 // This is a singleton -- use NSS::GetInstance()->Foo().
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020024 static NSS *GetInstance();
25
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020026 // Returns an empty path on failure.
Albert Chaulk0e1cdea2013-02-27 15:32:55 -080027 virtual base::FilePath GetPEMCertfile(const std::string &nickname,
28 const std::vector<char> &id);
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020029
30 // Returns an empty path on failure.
Albert Chaulk0e1cdea2013-02-27 15:32:55 -080031 virtual base::FilePath GetDERCertfile(const std::string &nickname,
32 const std::vector<char> &id);
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020033
34 protected:
35 NSS();
36
37 private:
38 friend struct base::DefaultLazyInstanceTraits<NSS>;
39 friend class NSSTest;
40 FRIEND_TEST(NSSTest, GetCertfile);
41
Albert Chaulk0e1cdea2013-02-27 15:32:55 -080042 base::FilePath GetCertfile(const std::string &nickname,
43 const std::vector<char> &id,
44 const std::string &type);
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020045
Jorge Lucangeli Obesccd5c852012-12-19 18:08:40 -080046 Minijail *minijail_;
Darin Petkov3c5e4dc2012-04-02 14:44:27 +020047
48 DISALLOW_COPY_AND_ASSIGN(NSS);
49};
50
51} // namespace shill
52
53#endif // SHILL_NSS_