HTML Tag Reference - HTML tag <keygen>








The <keygen> tag marks a key-pair generator field used for forms.

Browser compatibility

<keygen> Yes No Yes Yes Yes

What's new in HTML5

The <keygen> element is new in HTML5.

Attribute

Attribute Value Description
autofocus autofocus Mark whether a <keygen> element should automatically get focus when the page loads
challenge challenge Set that the value of the <keygen> element should be challenged when submitted
disabled disabled disable that a <keygen> element
form form_id Set the owner form id for the <keygen> element
keytype rsa
dsa
ec
Set the security algorithm of the key
name name Set a name for the <keygen> element




Global Attributes

The <keygen> tag supports the Global Attributes in HTML.

Event Attributes

The <keygen> tag supports the Event Attributes in HTML.

Default CSS Settings

None.

Example

<!DOCTYPE html>
<html>
<body>
<!--  w w  w  . j  a v  a2s.co  m-->
<form action="demo.asp" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="security">
  <input type="submit">
</form>
</body>
</html>

Click to view the demo