English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML5: <keygen> tag

The HTML <keygen> element is designed to facilitate the generation of key material and the submission of the public key as part of an HTML form. This mechanism is used to design Web-based certificate management systems. As envisioned, the <keygen> element will be used to construct a certificate request along with other required information in an HTML form, resulting in a signed certificate.

This tag has been deprecated in the new Web standard.

Online Example

Form with keygen field:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>Basic Tutorial(oldtoolbag.com)</title> 
</head>
<body>
<form action="demo-form.php" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="name" challenge="challenge string" keytype="type" keyparams="pqg-params">
  <input type="submit">
</form>
<p><strong>Attention:/strong>Internet Explorer does not support the keygen tag.</p>
</body>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

Firefox, Opera, Chrome, and Safari 6 All support the <keygen> tag.

Definition and usage description of the tag

The <keygen> tag specifies a key pair generator field for the form.

When submitting a form, the private key is stored locally, and the public key is sent to the server.

This feature has been removed from the Web standard, although some browsers still support it at present, it may stop supporting it at some point in the future. Please try not to use this feature.

HTML 4.01 between HTML5difference

<keygen> element is an HTML5 New Tag.

Attribute

New: HTML5 New Attribute

AttributeValueDescription
autofocusHTML5autofocusMake the <keygen> field focused when the page loads.
challengeNewchallengeIf used, set the keygen value to prompt for at submission.
disabledHTML5disabledDisable the <keygen> element field.
formHTML5form_idDefine one or more forms that the <keygen> field belongs to.
keytypeHTML5rsa
dsa
ec
Define the secure algorithm for key generation.
nameHTML5nameDefine a unique name for the <keygen> element. The 'name' attribute is used to collect the value of a field when submitting a form.

Global Attributes

<keygen> tag supports global attributes, see the complete attribute table HTML Global Attributes.

event attributes

<keygen> tag supports all HTML Event Attributes.