Skip to content
Related Articles

Related Articles

How to set the security algorithm of key in HTML5 ?

View Discussion
Improve Article
Save Article
  • Last Updated : 01 Apr, 2021
View Discussion
Improve Article
Save Article

In this article, we will see how to set the security algorithm of key 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.

Syntax:

<keygen name = "name">

Example:

HTML




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

Output:

 

Supported Browsers:

  • Google Chrome
  • Firefox
  • Opera
  • Apple Safari
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!