| 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 NET_BASE_KEYGEN_HANDLER_H_ | 5 #ifndef NET_BASE_KEYGEN_HANDLER_H_ | 
| 6 #define NET_BASE_KEYGEN_HANDLER_H_ | 6 #define NET_BASE_KEYGEN_HANDLER_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <string> | 9 #include <string> | 
| 10 | 10 | 
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" | 
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" | 
| 14 | 14 | 
| 15 #if defined(USE_NSS) | 15 #if defined(USE_NSS) | 
| 16 namespace base { | 16 #include "crypto/crypto_module_blocking_password_delegate.h" | 
| 17 class CryptoModuleBlockingPasswordDelegate; |  | 
| 18 }; |  | 
| 19 #endif  // defined(USE_NSS) | 17 #endif  // defined(USE_NSS) | 
| 20 | 18 | 
| 21 namespace net { | 19 namespace net { | 
| 22 | 20 | 
| 23 // This class handles keypair generation for generating client | 21 // This class handles keypair generation for generating client | 
| 24 // certificates via the <keygen> tag. | 22 // certificates via the <keygen> tag. | 
| 25 // <http://dev.w3.org/html5/spec/Overview.html#the-keygen-element> | 23 // <http://dev.w3.org/html5/spec/Overview.html#the-keygen-element> | 
| 26 // <https://developer.mozilla.org/En/HTML/HTML_Extensions/KEYGEN_Tag> | 24 // <https://developer.mozilla.org/En/HTML/HTML_Extensions/KEYGEN_Tag> | 
| 27 | 25 | 
| 28 class KeygenHandler { | 26 class KeygenHandler { | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 41 | 39 | 
| 42   // Exposed only for unit tests. | 40   // Exposed only for unit tests. | 
| 43   void set_stores_key(bool store) { stores_key_ = store;} | 41   void set_stores_key(bool store) { stores_key_ = store;} | 
| 44 | 42 | 
| 45 #if defined(USE_NSS) | 43 #if defined(USE_NSS) | 
| 46   // Register the password delegate to be used if the token is unauthenticated. | 44   // Register the password delegate to be used if the token is unauthenticated. | 
| 47   // GenKeyAndSignChallenge runs on a worker thread, so using the blocking | 45   // GenKeyAndSignChallenge runs on a worker thread, so using the blocking | 
| 48   // password callback is okay here. | 46   // password callback is okay here. | 
| 49   // Takes ownership of the delegate. | 47   // Takes ownership of the delegate. | 
| 50   void set_crypto_module_password_delegate( | 48   void set_crypto_module_password_delegate( | 
| 51       base::CryptoModuleBlockingPasswordDelegate* delegate); | 49       crypto::CryptoModuleBlockingPasswordDelegate* delegate); | 
| 52 #endif  // defined(USE_NSS) | 50 #endif  // defined(USE_NSS) | 
| 53 | 51 | 
| 54  private: | 52  private: | 
| 55   int key_size_in_bits_;  // key size in bits (usually 2048) | 53   int key_size_in_bits_;  // key size in bits (usually 2048) | 
| 56   std::string challenge_;  // challenge string sent by server | 54   std::string challenge_;  // challenge string sent by server | 
| 57   GURL url_;  // the URL that requested the key | 55   GURL url_;  // the URL that requested the key | 
| 58   bool stores_key_;  // should the generated key-pair be stored persistently? | 56   bool stores_key_;  // should the generated key-pair be stored persistently? | 
| 59 #if defined(USE_NSS) | 57 #if defined(USE_NSS) | 
| 60   // The callback for requesting a password to the PKCS#11 token. | 58   // The callback for requesting a password to the PKCS#11 token. | 
| 61   scoped_ptr<base::CryptoModuleBlockingPasswordDelegate> | 59   scoped_ptr<crypto::CryptoModuleBlockingPasswordDelegate> | 
| 62       crypto_module_password_delegate_; | 60       crypto_module_password_delegate_; | 
| 63 #endif  // defined(USE_NSS) | 61 #endif  // defined(USE_NSS) | 
| 64 }; | 62 }; | 
| 65 | 63 | 
| 66 }  // namespace net | 64 }  // namespace net | 
| 67 | 65 | 
| 68 #endif  // NET_BASE_KEYGEN_HANDLER_H_ | 66 #endif  // NET_BASE_KEYGEN_HANDLER_H_ | 
| OLD | NEW | 
|---|