HTML <keygen> (Key Pair Generation) Tag

❮ Previous Reference Next ❯

Deprecated: Not Supported in HTML5.

Example

<form action="action.php">
  <label>Username: <input type="text" name="username"></label>
  <label>Encryption: <keygen name="key"></label>
  <input type="submit" value="Submit">
</form>

Meaning

The <keygen> element is used to control the generation of key pairs in secured communications.

On form submission, the browser will generate a key pair and store the private key in the browser’s private key storage and send the public key to the server.

Version: HTML5




Standard Syntax

HTML: <keygen>
XHTML: <keygen />



Browser Support




Status







Attributes

Attribute Value Description
autofocus autofocus 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.
disabled disabled Specifies that the keygen form control disabled for interaction.
form formId Specifies the <form> element that the <keygen> element is associated with (its form owner).
keytype rsa
dsa
ec
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.



Global Attributes

<keygen> element also supports the Global Attributes in HTML.


Event Attributes

<keygen> element also supports the Event Attributes in HTML.




❮ Previous Reference Next ❯