keygen

FilterElements

HTML: <keygen>
XHTML: <keygen/>  or  <keygen />

HTML5 only. Used as part of a form to generate key pairs that are used in web-based certificate management systems (for secure transactions).

Start/End Tags

This is an empty element. It must be closed with a trailing slash in XHTML5 documents. Developers may include a space character before the slash for backward compatibility with older browsers.

Specifications

  • HTML5

autofocus

Values: None in HTML. (autofocus="autofocus" in XHTML5.)
Indicates the control should be active and ready for user input when the document loads.

challenge=

Values: challenge-string
Provides a challenge string to be submitted with the key.

disabled

Values: None in HTML. (disabled="disabled" in XHTML5.)
Prevents the control from being interactive and prevents its value from being submitted.

form=

Values: id of form owner
Associates the element with a named form on the page.

keytype=

Values: keyword
Identifies the type of key to be generated, for example, rsa or ec.

name=

Values: text
Gives the control an identifying name for the form submission process.

The following is based on an example from developer.mozilla.org, used with permission via a Creative Commons “Attribution-Share Alike” License:

<form method="post" action="http://www.example.com/cgi-bin/ decode.cgi">
  <keygen name="RSA public key" challenge="123456789" keytype="RSA">
  <input type="submit" name="createcertificate" value="Make Key">
</form>

Rendered Example