Javascript Reference - HTML DOM Keygen keytype Property

The keytype property sets or gets the keytype attribute of a keygen field.

Browser Support

Keygen keytype Yes No Yes Yes Yes


Return the keytype property.

var v = keygenObject.keytype 

Set the keytype property.


Property Values

Value Description
rsa Default. Specifies an RSA security algorithm.
dsa Specifies a DSA security algorithm.
ec Specifies an EC security algorithm.

Return Value

A String type value representing the type of key used.


The following code shows how to get the type of key used.

<!DOCTYPE html>
Encryption: <keygen id="myKeygen" name="security" keytype="rsa">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
function myFunction() {<!--from   ww  w  . j  ava2  s . co m-->
    var x = document.getElementById("myKeygen").keytype;
    document.getElementById("demo").innerHTML = x;


The code above is rendered as follows: