HTML Keygen
HTML Keygen Tag
The
<keygen>
tag specifies a key-pair generator field used for forms.
When the form is submitted, the private key is stored locally, and the public key is sent to the server.
<!DOCTYPE html>
<html lang="en">
<head>
<title> HTML Keygen Tag </title>
<meta charset="UTF-8">
</head>
<body>
<form action="action-page.php" method="get">
Username: <input type="text" name="usr_name">
Encryption: <keygen name="security">
<input type="submit">
</form>
</body>
</html>
Output
Note: This tag is not used often and is about to get removed from HTML 5.
HTML Keygen Attributes
Attributes |
Description |
autofocus |
Specifies that a <keygen> element should automatically get focus when the page loads. |
challenge |
Specifies that the value of the <keygen> element should be challenged when submitted. |
form |
Specifies one or more forms the <keygen> element belongs to. |
disabled |
Specifies that a <keygen> element should be disabled. |
keytype |
Specifies the security algorithm of the key. |
name |
Defines a name for the <keygen> element. |
Browser Support
Element |
Edge |
Chrome |
Firefox |
Opera |
Safari |
<keygen> |
Yes |
Yes |
Yes |
Yes |
Yes |