summaryrefslogtreecommitdiffstats
path: root/net/base/keygen_handler.h
diff options
context:
space:
mode:
authorsnej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 17:47:02 +0000
committersnej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 17:47:02 +0000
commitcdafbff7b3e83702c20b0f754a6d27159b78c06c (patch)
tree5b66619f7822e7189e8cc3287365ed49808d3c72 /net/base/keygen_handler.h
parent078a10a1c64458e5f5c4fdf57edbbc935dd145ca (diff)
downloadchromium_src-cdafbff7b3e83702c20b0f754a6d27159b78c06c.zip
chromium_src-cdafbff7b3e83702c20b0f754a6d27159b78c06c.tar.gz
chromium_src-cdafbff7b3e83702c20b0f754a6d27159b78c06c.tar.bz2
Mac: implement <keygen> support, including adding generated cert to the Keychain.
BUG=34607 TEST=KeygenHandlerTest.SmokeTest Review URL: http://codereview.chromium.org/652137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/keygen_handler.h')
-rw-r--r--net/base/keygen_handler.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/net/base/keygen_handler.h b/net/base/keygen_handler.h
index 346b577..1ed023e 100644
--- a/net/base/keygen_handler.h
+++ b/net/base/keygen_handler.h
@@ -10,18 +10,36 @@
namespace net {
// This class handles keypair generation for generating client
-// certificates via the Netscape <keygen> tag.
+// certificates via the <keygen> tag.
+// <http://dev.w3.org/html5/spec/Overview.html#the-keygen-element>
+// <https://developer.mozilla.org/En/HTML/HTML_Extensions/KEYGEN_Tag>
class KeygenHandler {
public:
- KeygenHandler(int key_size_index, const std::string& challenge);
+ // Creates a handler that will generate a key with the given key size
+ // and incorporate the |challenge| into the Netscape SPKAC structure.
+ inline KeygenHandler(int key_size_in_bits, const std::string& challenge);
+
+ // Actually generates the key-pair and the cert request (SPKAC), and returns
+ // a base64-encoded string suitable for use as the form value of <keygen>.
std::string GenKeyAndSignChallenge();
+ // Exposed only for unit tests.
+ void set_stores_key(bool store) { stores_key_ = store;}
+
private:
- int key_size_index_;
- std::string challenge_;
+ int key_size_in_bits_; // key size in bits (usually 2048)
+ std::string challenge_; // challenge string sent by server
+ bool stores_key_; // should the generated key-pair be stored persistently?
};
+KeygenHandler::KeygenHandler(int key_size_in_bits,
+ const std::string& challenge)
+ : key_size_in_bits_(key_size_in_bits),
+ challenge_(challenge),
+ stores_key_(true) {
+}
+
} // namespace net
#endif // NET_BASE_KEYGEN_HANDLER_H_