| OLD | NEW |
| 1 // Copyright (c) 2011 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 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 BlobFromBuffer(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 MightHaveKeys() = 0; |
| 46 |
| 45 virtual bool OpenUserDB() = 0; | 47 virtual bool OpenUserDB() = 0; |
| 46 | 48 |
| 47 // Caller takes ownership of returned key. | 49 // Caller takes ownership of returned key. |
| 48 virtual base::RSAPrivateKey* GetPrivateKey( | 50 virtual base::RSAPrivateKey* GetPrivateKey( |
| 49 const std::vector<uint8>& public_key_der) = 0; | 51 const std::vector<uint8>& public_key_der) = 0; |
| 50 | 52 |
| 51 // Caller takes ownership of returned key. | 53 // Caller takes ownership of returned key. |
| 52 virtual base::RSAPrivateKey* GenerateKeyPair() = 0; | 54 virtual base::RSAPrivateKey* GenerateKeyPair() = 0; |
| 53 | 55 |
| 54 virtual FilePath GetOwnerKeyFilePath() = 0; | 56 virtual FilePath GetOwnerKeyFilePath() = 0; |
| 55 | 57 |
| 56 virtual bool Verify(const uint8* algorithm, int algorithm_len, | 58 virtual bool Verify(const uint8* algorithm, int algorithm_len, |
| 57 const uint8* signature, int signature_len, | 59 const uint8* signature, int signature_len, |
| 58 const uint8* data, int data_len, | 60 const uint8* data, int data_len, |
| 59 const uint8* public_key, int public_key_len) = 0; | 61 const uint8* public_key, int public_key_len) = 0; |
| 60 | 62 |
| 61 virtual bool Sign(const uint8* data, int data_len, | 63 virtual bool Sign(const uint8* data, int data_len, |
| 62 std::vector<uint8>* OUT_signature, | 64 std::vector<uint8>* OUT_signature, |
| 63 base::RSAPrivateKey* key) = 0; | 65 base::RSAPrivateKey* key) = 0; |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 static Factory* factory_; | 68 static Factory* factory_; |
| 67 DISALLOW_COPY_AND_ASSIGN(NssUtil); | 69 DISALLOW_COPY_AND_ASSIGN(NssUtil); |
| 68 }; | 70 }; |
| 69 } // namespace login_manager | 71 } // namespace login_manager |
| 70 | 72 |
| 71 #endif // LOGIN_MANAGER_NSS_UTIL_H_ | 73 #endif // LOGIN_MANAGER_NSS_UTIL_H_ |
| OLD | NEW |