Computer >> Computer tutorials >  >> Programming >> HTML

What is <keygen> tag in HTML?


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.

The keygen tag supports the following additional attributes −

Attribute
Value
Description
autofocus What is <keygen> tag in HTML?
autofocus
Specifies that when the page loads the <keygen> element automatically gets focus.
challenge What is <keygen> tag in HTML? 
challengeSpecifies 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 What is <keygen> tag in HTML?
disabledSpecifies that <keygen> element should be disabled
form What is <keygen> tag in HTML?
form_id
Specifies one or more forms.
keytype What is <keygen> tag in HTML?   
rsa
dsa
ec
Specifies the secret algorithm which is for the key.
name What is <keygen> tag in HTML?rsadsaecSpecifies a name.

Example

You can try to run the following code to implement <keygen> tag in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML keygen Tag</title>
   </head>
   <body>
      <form>
         <keygen name = "random_key" challenge = "0987654321">
         <input name = "subject" value = "subject">
      </form>
   </body>
</html>