OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LOGIN_MANAGER_NSS_UTIL_H_ | 5 #ifndef LOGIN_MANAGER_NSS_UTIL_H_ |
6 #define LOGIN_MANAGER_NSS_UTIL_H_ | 6 #define LOGIN_MANAGER_NSS_UTIL_H_ |
7 | 7 |
8 #include <base/basictypes.h> | 8 #include <base/basictypes.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
(...skipping 21 matching lines...) Expand all Loading... |
33 // |factory|. A value of NULL results in an NssUtil being | 33 // |factory|. A value of NULL results in an NssUtil being |
34 // created directly. | 34 // created directly. |
35 #if defined(UNIT_TEST) | 35 #if defined(UNIT_TEST) |
36 static void set_factory(Factory* factory) { factory_ = factory; } | 36 static void set_factory(Factory* factory) { factory_ = factory; } |
37 #endif | 37 #endif |
38 | 38 |
39 // Creates an NssUtil, ownership returns to the caller. If there is no | 39 // Creates an NssUtil, ownership returns to the caller. If there is no |
40 // Factory (the default) this creates and returns a new NssUtil. | 40 // Factory (the default) this creates and returns a new NssUtil. |
41 static NssUtil* Create(); | 41 static NssUtil* Create(); |
42 | 42 |
43 static void KeyFromBuffer(const std::string& buf, std::vector<uint8>* out); | 43 static void BlobFromBuffer(const std::string& buf, std::vector<uint8>* out); |
44 | 44 |
45 virtual bool OpenUserDB() = 0; | 45 virtual bool OpenUserDB() = 0; |
46 | 46 |
47 // Caller takes ownership of returned key. | 47 // Caller takes ownership of returned key. |
48 virtual base::RSAPrivateKey* GetPrivateKey( | 48 virtual base::RSAPrivateKey* GetPrivateKey( |
49 const std::vector<uint8>& public_key_der) = 0; | 49 const std::vector<uint8>& public_key_der) = 0; |
50 | 50 |
51 // Caller takes ownership of returned key. | 51 // Caller takes ownership of returned key. |
52 virtual base::RSAPrivateKey* GenerateKeyPair() = 0; | 52 virtual base::RSAPrivateKey* GenerateKeyPair() = 0; |
53 | 53 |
54 virtual FilePath GetOwnerKeyFilePath() = 0; | 54 virtual FilePath GetOwnerKeyFilePath() = 0; |
55 | 55 |
56 virtual bool Verify(const uint8* algorithm, int algorithm_len, | 56 virtual bool Verify(const uint8* algorithm, int algorithm_len, |
57 const uint8* signature, int signature_len, | 57 const uint8* signature, int signature_len, |
58 const uint8* data, int data_len, | 58 const uint8* data, int data_len, |
59 const uint8* public_key, int public_key_len) = 0; | 59 const uint8* public_key, int public_key_len) = 0; |
60 | 60 |
61 virtual bool Sign(const uint8* data, int data_len, | 61 virtual bool Sign(const uint8* data, int data_len, |
62 std::vector<uint8>* OUT_signature, | 62 std::vector<uint8>* OUT_signature, |
63 base::RSAPrivateKey* key) = 0; | 63 base::RSAPrivateKey* key) = 0; |
64 | 64 |
65 private: | 65 private: |
66 static Factory* factory_; | 66 static Factory* factory_; |
67 DISALLOW_COPY_AND_ASSIGN(NssUtil); | 67 DISALLOW_COPY_AND_ASSIGN(NssUtil); |
68 }; | 68 }; |
69 } // namespace login_manager | 69 } // namespace login_manager |
70 | 70 |
71 #endif // LOGIN_MANAGER_NSS_UTIL_H_ | 71 #endif // LOGIN_MANAGER_NSS_UTIL_H_ |
OLD | NEW |