From W3C Wiki
< HTML‎ | Elements
Jump to: navigation, search


The <keygen> element represents a key pair generator control.


  • When the control's form is submitted, the private key is stored in the local keystore, and the public key is packaged and sent to the server.

HTML Attributes

  • autofocus = boolean
    Allows the author to indicate that a control is to be focused as soon as the page is loaded

  • challenge = string
    A challenge string that is submitted along with the public key. [Example A]

  • disabled = boolean
    If present, make the control non-interactive and to prevent its value from being submitted.

  • form = the ID of a form element in the element's owner
    Associate the keygen element with its form owner.
    By default, the keygen element is associated with its nearest ancestor form element.

  • keytype = rsa
    The type of key generated.

  • name = unique name
    Represents the element's name.

See also global attributes.


Example A

[try it]:

<keygen name="key" challenge="235ldahlae983dadfar">

HTML Reference

The HTML5 specification defines the <keygen> element in 4.10.14 The keygen element.