Fetch HTML 5 Keygen Tag Value – PHP


Fetch HTML 5 Keygen Tag Value – PHP


The <keygen> tag specifies a key- pair generator field user for forms. When the form is submitted, the private key is stored locally and the public key is sent to the server.

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<form action="post_keygen.php" method="post">
User Name:
 <input type="text" name="username">
 <keygen name="key" keytype="rsa">
<input type="submit" value="Submit">

We can either use ASP.Net or PHP to capture the encryption key.

Below code will capture the key value and display on the web page.

echo "Username = ".$userName; 
echo "key = ".$securityKey; 


Keytype specifies the encryption algorithm, in this case keytype=”rsa”, i.e. RSA encryption algorithm will be used to encrypt the data.


HTML_keygen_tag HTML_keygen_tag_output

JavaScript, ASP.Net & PHP Web Developer. Connect with me on Facebook and Twitter.

Share This Post

Recent Articles

Powered by Paras Babbar · Designed by Paras Babbar