Open In App
Related Articles

How to set the security algorithm of key in HTML5 ?

Improve Article
Save Article
Like Article

In this article, we will see how to set the security algorithm of keys using HTML5. To set the security algorithm of key <keygen> tag is used. This tag specifies a key-pair generator field used for forms. The private key is saved locally and the public key is sent to the server when the form is sent. The element’s aim is to provide a safe method of user authentication. When a form is submitted, two keys, a private key, and a public key, are produced. The public key is sent to the server, while the private key is kept locally. The public key is used to build a client certificate that can be used to validate the user’s identity in the future.


<keygen name = "name">

Example: In this example, we are using <keygen> tag for specifying the security algorithm.


<!DOCTYPE html>
    <h1 style="color:green;">
        Specifying the security algorithm
        of the key in HTML5
        Username: <input type="text" name="name">
        <br><br> Encryption: <keygen name="key">
        <input type="submit">


Supported Browsers:

  • Google Chrome
  • Firefox
  • Opera
  • Apple Safari
Last Updated : 02 Jun, 2023
Like Article
Save Article
Similar Reads
Related Tutorials