Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML <keygen> keytype Attribute

  • Last Updated : 05 Oct, 2021

The HTML <keygen> keytype attribute is used to define the type of key which would be used. Basically, this attribute is used to secure the form data. 

Note: The keytype may be different in different browsers.

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

Syntax:

<keygen keytype="rsa|dsa|ec">

Attribute values:



  • rsa: It is a default value. It defines an RSA security algorithm. It gives a  choice of RSA key strengths to the user.
  • dsa: It defines a DSA security algorithm. It gives a choice of DSA key sizes to the user.
  • ec: It defines an EC security algorithm. It gives a choice of EC key strengths to the user.

 

Example: Below code illustrates the keytype attribute of the <keygen> element.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML keygen keytype attribute
    </title>
</head>
  
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
  
        <h2>HTML Keygen keytype attribute</h2>
  
        <form>
            Username: <input type="text" name="uname">
            <br><br>
            Encryption: <keygen form="myGeeks" 
                keytype="rsa" name="secure" disabled>
                  
            <input type="submit">
        </form>
      </center>
</body>
  
</html>

Output:              

Supported Browsers:

  • Google Chrome
  • Firefox
  • Opera



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!