WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML <keygen> Tag


Example

A form with a keygen field:

<form action="demo_keygen.asp" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="security">
  <input type="submit">
</form>
Try it yourself »

Definition and Usage

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.


Browser Support

The numbers in the table specify the first browser version that fully supports the element.

Element
<keygen> 1.0 Not supported Not supported 1.0 1.2 3.0

Differences Between HTML 4.01 and HTML5

The <keygen> element is new in HTML5.


Attributes

= New in HTML5.

attribute value Description
autofocus New autofocus make <keygen> Fields get focus when the page loads.
challenge New challenge If used, sets the value of keygen to be asked on submission.
disabled New disabled Disable <keygen> Element field.
form New form_id Define this <keygen> One or more forms to which the field belongs.
keytypeNew rsa
dsa
ec
Defines the security algorithm of the key.
name New name Definition <keygen> The unique name of the element. The name attribute is used to collect the value of the field when the form is submitted.