HTML - keygen Tag



The HTML <keygen> tag is used to process Web forms with certificate management systems. The element generates a secure key and submits the public key.

This tag is no longer recommended as it is deprecated in the HTML5.

Example

Let's look at the following example, where we are going to use the keygen tag.

<!DOCTYPE html>
<html>

   <head>
      <title>HTML keygen Tag</title>
   </head>

   <body>
      <form>
         <keygen name = "random_key" challenge = "0987654321">
         <input name = "firstname" value = "first name">
      </form>
   </body>

</html>

When we run the above code, it will generate an output consisting of the input field on the webpage.

Global Attributes

This tag supports all the global attributes described in HTML Attribute Reference

Specific Attributes

The HTML <keygen> tag also supports the following additional attributes −

Attribute Value Description
autofocus html-5 autofocus Specifies that when the page loads the <keygen> element automatically gets focus.
challengehtml-5 challenge Specifies the challenge string to be packaged with the public key in the PublicKeyAndChallenge for use in verification of the form submission. If no challenge string is provided, then it is encoded as an IA5STRING of length zero.
disabled html-5 disabled Specifies that <keygen> element should be disabled.
form html-5 form_id Specifies one or more forms.
keytype html-5 rsa
dsa
ec
Specifies the secret algorithm which is for the key.
name html-5 autofocus Specifies a name.

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Advertisements