Keygen Tag in HTML

A key-pair generator field within a form is defined using the HTML tag. The element's function is to offer a safe method of user authentication. A private key and a public key are generated upon submission of a form. The public key is transmitted to the server, and the private key is kept locally. In order to authenticate a user in the future, a client certificate is generated using the public key. The digital signature is generated and validated using the tag as well.

The user can select where the generated key will be stored from a variety of key size options using the element. The key is on disk or in a smart card or software. However, only if the user's browser is compatible with cryptographic hardware can it be performed. The following table shows the use and history of the tag.

Placement of tag:Inline of the form
Content in the tag:None. It is an empty element.
Start/End Tag:Start tag: required, End tag: not needed or not available
A version of HTML:HTML5

Syntax

The following example shows the keygen tag in HTML.

  1. Note: the keygen tag is not supported in html5.
  2. Attributes: The following is a list of the tag's properties:
    • name: It contains the element's name.
    • autofocus: It shows the element's focus after the page loads.
    • disabled: The element is made disabled through this keyword.
    • keytype: This describes the kind of algorithm that will be applied to create keys.

Examples

The following examples show the keygen tag in HTML. We can use the keygen tag in the HTML forms and other activities.

Example 1:

The following example shows the keygen tag in HTML. We can use the keygen tag with the name property.

Output:

The output shows the keygen in HTML for security.

Keygen Tag in HTML

Example 2:

The following example shows the keygen tag in HTML. We can use the keygen tag with the name property.

Output:

The output shows the keygen in HTML for security.

Keygen Tag in HTML

Example 3:

The following example shows the keygen tag in HTML. We can use the keygen tag with the autofocus, id, and form properties.

Output

The output shows the keygen in HTML for security.

Keygen Tag in HTML

Supported Browsers

The following browsers support the <keygen> tag: we can use autofocus, name, id and other attribute with the keygen tag for the browser's support.

  • Google Chrome
  • Firefox
  • Safari
  • Opera

Conclusion

The keygen tag is used in the HTML to provide privacy and security for the user efficiently.


Next TopicMailto html tag