Open In App

HTML <keygen> keytype Attribute

Last Updated : 05 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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.

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads