With HTML5 keygen tag we continue to discover the new HTML5 fields.
This tag is used to send keys in web authentication. When the form is submitted, two keys are created, one public key that is sent to the server and will later be used to continue authentication in the system, and another private key that is stored locally in the browser.
This is deprecated since 2018.
The syntax is very simple, here I put its code:
<keygen name="pass">
As you can see, it is a tag that is assigned a name.
More info about the HTML5 keygen in this link.
In the following example of HTML5 keygen we will see the value of the sent public key. Once you press the send button, you will see how a box calculates the key:
<form action="form.php" method="post"> User: <input type="text" name="user"> Pass: <keygen name="pass"> <input type="submit" value="Send"> </form>
I put the PHP code to obtain the public key sent by POST.
<?php if ($_POST['pass']) echo "Public key: " .$_POST['pass']; ?>