OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ | 5 #ifndef CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ |
6 #define CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ | 6 #define CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ |
7 #pragma once | |
8 | 7 |
9 #include <string> | 8 #include <string> |
10 | 9 |
11 namespace crypto { | 10 namespace crypto { |
12 | 11 |
13 // PK11_SetPasswordFunc is a global setting. An implementation of | 12 // PK11_SetPasswordFunc is a global setting. An implementation of |
14 // CryptoModuleBlockingPasswordDelegate should be passed as the user data | 13 // CryptoModuleBlockingPasswordDelegate should be passed as the user data |
15 // argument (|wincx|) to relevant NSS functions, which the global password | 14 // argument (|wincx|) to relevant NSS functions, which the global password |
16 // handler will call to do the actual work. | 15 // handler will call to do the actual work. |
17 class CryptoModuleBlockingPasswordDelegate { | 16 class CryptoModuleBlockingPasswordDelegate { |
18 public: | 17 public: |
19 virtual ~CryptoModuleBlockingPasswordDelegate() {} | 18 virtual ~CryptoModuleBlockingPasswordDelegate() {} |
20 | 19 |
21 // Requests a password to unlock |slot_name|. The interface is | 20 // Requests a password to unlock |slot_name|. The interface is |
22 // synchronous because NSS cannot issue an asynchronous | 21 // synchronous because NSS cannot issue an asynchronous |
23 // request. |retry| is true if this is a request for the retry | 22 // request. |retry| is true if this is a request for the retry |
24 // and we previously returned the wrong password. | 23 // and we previously returned the wrong password. |
25 // The implementation should set |*cancelled| to true if the user cancelled | 24 // The implementation should set |*cancelled| to true if the user cancelled |
26 // instead of entering a password, otherwise it should return the password the | 25 // instead of entering a password, otherwise it should return the password the |
27 // user entered. | 26 // user entered. |
28 virtual std::string RequestPassword(const std::string& slot_name, bool retry, | 27 virtual std::string RequestPassword(const std::string& slot_name, bool retry, |
29 bool* cancelled) = 0; | 28 bool* cancelled) = 0; |
30 }; | 29 }; |
31 | 30 |
32 } // namespace crypto | 31 } // namespace crypto |
33 | 32 |
34 #endif // CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ | 33 #endif // CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ |
OLD | NEW |