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 ![]() | 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. |
keytype ![]() | rsa dsa ec | Specifies the secret algorithm which is for the key. |
name ![]() | rsadsaec | Specifies 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>