HTML <keygen> element


<keygen> is a new HTML5 element. It defines a key pair in a form for submit. It's a void tag, no closing tag </keygen> is needed.

<form action="keygen.php" method=post>
User: <input type="text" name="user"><br>
Keygen: <keygen name="keyg"><br>
<input type=submit value="Submit Keygen">
</form>
<br><br>
<?PHP
   if ($user != "")
       echo "user: $user<br>keygen: $keyg";
?>

User:
Keygen:




PHP code at the beginning of this file:
<?PHP
  $user="";
  $keyg="";
  if (isset($_POST['user']))
  {
      $user=$_POST['user'];
  }
  if (isset($_POST['keyg']))
  {
      $keyg=$_POST['keyg'];
  }
?>

Specific attributes of <keygen> tag:
AttributeDescription
autofocus automatically focus on the tag when pages loads
challenge the value will be challenged when submitted
disabled disable the tag
form form name
keytype key type difinition. RSA: public key encrption algorithm
name name of the tag