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

Syntax

Return the keytype property.

var v = keygenObject.keytype 

Set the keytype property.

keygenObject.keytype='rsa|dsa|ec'

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.

Example

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


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

</body>
</html>

The code above is rendered as follows: