The keygen element was initially introduced by Netscape and later accepted by other browsers. The keygen element is intended to provide a safer way to authenticate users; that is done in that manner that the <keygen> generates a public-private key-pair field in a form. When a form gets submitted, a public key and a private key are generated; the private key gets stored on the client side (local PC), and the public key gets sent to the server. Thus created, this key-pair combination may be used with secure servers to generate certificates or similar, increasing an overall security of our systems.
Syntax:
<input type="text" name="username" />
<keygen name="secure-key" />
Attributes:
- name - Specifies the name of the <keygen> element.
- keytype - Specifies which security algorithm will be used. Following values are accepted:
- rsa
- dca
- es
- autofocus - Tells browser whether the <keygen> element will get an automatic focus after page loads, or not; the value is autocomplete.
- form - Specifies form or forms that the <keygen> element belongs too; the value is form_id.
- challenge - Defines the <keygen> as "to be challenged" when submitted.
- disabled - A standard disabled value that most of the form element have; it disables the <keygen> element.
- global attributes
- event attributes
Example
The keygen element usage example:
x
<html>
<head>
<style type="text/css">
p {margin: 10px 5px; padding:5px;}
</style>
</head>
<body>
<form action="../../../img/tutorials/keygen_example.php" method="get" enctype="multipart/form-data">
<p>Enter a number: <input type="number" name="inp"></p>
<p>Encryption: <keygen name="sec"></p>
<input type="submit" value="Submit">
</form>
</body>
</html>
Comments
No comments have been made yet.
Please login to leave a comment. Login now