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 |
---|---|---|
autofocus![]() | autofocus | Specifies that when the page loads the <keygen> element automatically gets focus. |
challenge![]() | 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![]() | disabled | Specifies that <keygen> element should be disabled. |
form![]() | form_id | Specifies one or more forms. |
![]() | rsa dsa ec | Specifies the secret algorithm which is the key. |
name![]() | autofocus | 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>