HTML keygen tag

HTML keygen tag is used to generate key pairs public and private keys.

The keygen tag used for the encryption to pass the encrypted data to the server.

The keygen tag is used inside HTML form tag. When the form get sumitted, the browser will generate the key pairs. The browser then store the private key in the browser key storage then after it send the public key to the server.


Syntax

This is the example for html keygen tag using inside form tag to generate two key ke pairs.

Output






List of HTML keygen tag attributes

Sr. No. Atribute options Description
1 name This attribute contains the name of the keygen element used for form submission.
2 form This specified the id of the form to use for the key generation. The value for this is the id of the form
3 keytype This specified the type of the algorithm for key generation. The values for this attribute are rsadsa and ec
4 disabled This attribute can be used to disable the keygen element. This contains boolean value disabled
5 challenged This attribute can be used to specify the keygen element should be challenged when submitted.
6 autofocus This attribute can be used to aumattically focus the keygen element on page load.

Resources and References

1. W3C Specification.