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.


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


List of HTML keygen tag attributes

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

Resources and References

1. W3C Specification.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.