| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_NSS_CRYPTO_MODULE_DELEGATE_H_ | 5 #ifndef CRYPTO_NSS_CRYPTO_MODULE_DELEGATE_H_ |
| 6 #define CRYPTO_NSS_CRYPTO_MODULE_DELEGATE_H_ | 6 #define CRYPTO_NSS_CRYPTO_MODULE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 void* wincx() { return this; } | 28 void* wincx() { return this; } |
| 29 | 29 |
| 30 // Requests a password to unlock |slot_name|. The interface is synchronous | 30 // Requests a password to unlock |slot_name|. The interface is synchronous |
| 31 // because NSS cannot issue an asynchronous request. |retry| is true if this | 31 // because NSS cannot issue an asynchronous request. |retry| is true if this |
| 32 // is a request for the retry and we previously returned the wrong password. | 32 // is a request for the retry and we previously returned the wrong password. |
| 33 // The implementation should set |*cancelled| to true if the user cancelled | 33 // The implementation should set |*cancelled| to true if the user cancelled |
| 34 // instead of entering a password, otherwise it should return the password the | 34 // instead of entering a password, otherwise it should return the password the |
| 35 // user entered. | 35 // user entered. |
| 36 virtual std::string RequestPassword(const std::string& slot_name, bool retry, | 36 virtual std::string RequestPassword(const std::string& slot_name, bool retry, |
| 37 bool* cancelled) = 0; | 37 bool* cancelled) = 0; |
| 38 | |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 // Extends CryptoModuleBlockingPasswordDelegate with the ability to return a | 40 // Extends CryptoModuleBlockingPasswordDelegate with the ability to return a |
| 42 // slot in which to act. (Eg, which slot to store a generated key in.) | 41 // slot in which to act. (Eg, which slot to store a generated key in.) |
| 43 class NSSCryptoModuleDelegate : public CryptoModuleBlockingPasswordDelegate { | 42 class NSSCryptoModuleDelegate : public CryptoModuleBlockingPasswordDelegate { |
| 44 public: | 43 public: |
| 45 ~NSSCryptoModuleDelegate() override {} | 44 ~NSSCryptoModuleDelegate() override {} |
| 46 | 45 |
| 47 // Get the slot to store the generated key. | 46 // Get the slot to store the generated key. |
| 48 virtual ScopedPK11Slot RequestSlot() = 0; | 47 virtual ScopedPK11Slot RequestSlot() = 0; |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 } // namespace crypto | 50 } // namespace crypto |
| 52 | 51 |
| 53 #endif // CRYPTO_NSS_CRYPTO_MODULE_DELEGATE_H_ | 52 #endif // CRYPTO_NSS_CRYPTO_MODULE_DELEGATE_H_ |
| OLD | NEW |