Skip to navigation

HTML Tag: keygen

A form control for generating a key pair, used for user authentication purposes.

keygen has no content and therefore does not warrant a closing tag.

Optional Attributes

Attribute Description Possible values
name Name of the form control, to be paired with its value. Text (no spaces).
challenge A verification challenge to be sent along with the key. Text.
keytype The key security type. rsa (also default).
disabled Disables the form control. None.
autofocus Indicates that the form control should have focus on page load. Should only be used on one form control in a page. None.
form Explicitly associates the control to a form element, which it may or may not be nested within. If absent, the control will be associated to its form ancestor. Text matching the value of a form element’s id attribute.
Global attributes


<form action="keyGen/">
    <label for="kName">Name</label>
    <input name="kName" id="kName">

    <label for="kLength">Key length</label>
    <keygen name="kLength" id="kLength" challenge="banana">

    <input type="submit">