HTML CSS examples for HTML Tag:keygen
The keygen element generates a public/private pair of keys.
When the form is submitted, a new pair of keys is created.
The public key is sent to the server, and the private key is retained by the browser and added to the user's key store.
The keygen Element summary
Element: | keygen |
---|---|
Local Attributes: | challenge, keytype, autofocus, name, disabled, form |
Contents: | None |
Tag Style: | Void |
New in HTML5? | Yes |
Changes in HTML5: | N/A |
Style Convention: | None |
The name, disabled, form, and autofocus attributes work as they do for the input element.
The keytype attribute sets the algorithm to generate the key pair, but the only supported value is RSA.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of HTML keygen Tag</title> </head><!-- w w w . ja va 2 s . c o m--> <body> <form action="../html5/demo_keygen.php" method="post"> <label>Username: <input type="text" name="username"></label> <label>Encryption: <keygen name="key"></label> <input type="submit" value="Submit"> </form> <p><strong>Note:</strong> The keygen tag is not supported in Internet Explorer.</p> </body> </html>
The following table shows the attributes that are specific to the <keygen> tag.
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | This Boolean attribute specifies that a keygen element should automatically get focus when the page loads. |
challenge | challenge | Specifies a challenge string that is submitted along with the public key. The default value is an empty string, if not specified. |
disabled | disabled | This Boolean attribute indicates that the keygen form control disabled for interaction. |
form | form-id | Specifies the <form> element that the <keygen> element is associated with (its form owner). |
keytype | rsadsaec | Specifies the type of key generated. The default value is 'rsa'. |
name | name | Defines a name for the keygen element, which is submitted with the form data. |