How to define a key-pair generator field in HTML5 ?
The HTML <keygen> element can help generate a key material as part of an HTML form and submit the public key. This mechanism is intended for use with certificate systems based on the web. The <keygen> element is expected to be used in an HTML form along with additional information necessary to build a certificate request, and a signed certificate will be the result of the process.
Syntax: The syntax of <keygen> tag is
<keygen name="name">
Example 1:
HTML
<!DOCTYPE html> < html > < head > < title >GFG</ title > </ head > < body > < form action = "/gfg" method = "post" > < label >Username: < input type = "text" name = "uname" ></ label > < label >Encryption: < keygen name = "lock" ></ label > < input type = "submit" value = "Submit" > </ form > </ body > </ html > |
Output:

keygen
Example 2:
HTML
<!DOCTYPE html> < html > < head > < title >GFG</ title > </ head > < body > < form > < keygen name = "key" challenge = "000" > < input name = "name" value = "Name" > </ form > </ body > </ html > |
Output:

keygen challenge
Please Login to comment...