How to use the tag in HTML?


The HTML <keygen> tag is to process web forms with certificate management systems. On form submission, the private key gets stored locally and submits the public key to the server.

Here are the attributes of the <keygen> tag −

Attribute
Value
Description
autofocusautofocus
Specifies that when the page loads the <keygen> element automatically gets focus.
challengechallenge
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.
disableddisabled
Specifies that <keygen> element should be disabled.
formform_id
Specifies one or more forms.
keytype
rsa
dsa
ec
Specifies the secret algorithm which is the key.
nameautofocus
Specifies a name.


Example

You can try to run the following code to learn about the usage of <keygen> tag in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML keygen Tag</title>
   </head>
   <body>
      <form>
         <keygen name = "random_key" challenge = "0987655421">
         <input name = "sname" value = "Student Name">
      </form>
   </body>
</html>

Rishi Raj
Rishi Raj

I am a coder

Updated on: 15-Jun-2020

121 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements