Skip to content
Related Articles

Related Articles

Improve Article

How to set a name for keygen element in HTML5 ?

  • Last Updated : 01 Apr, 2021

In HTML, the <keygen> tag is used to specify a key-pair generator field during a form and the <keygen> name attribute is used to set thename of keygen element. The aim of <keygen> element is to supply a secure thanks to authenticate users. When a from is submitted then two keys are generated, private key and public key. The private key stored locally, and therefore the public key’s sent to the server. The general public key’s wont to generate client certificate to authenticate user for future. So basically it’s wont to encrypt and decrypt data.

Syntax

<keygen name = "name">

Note: In HTML5, keygen is no longer supported.

The attributes of <keygen> tag are listed below:

  • name: It specifies the name of <keygen> element.
  • autofocus: It specifies the focus to the element after a web page loads.
  • disabled: It sets the element disabled.
  • keytype: It specifies the type of algorithm to be used for key generation.

Example:



HTML




<!DOCTYPE html>
<html>
  
<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h2>
        Defining a name for the 
        keygen element in HTML 5
    </h2>
  
    <form>
        Username: <input type="text" name="uname">
        Encryption: <keygen name="security">
        <input type="submit">
    </form>
</body>
  
</html>

Output:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :