W3Schools.com

HTML5 <keygen> Tag

Example

A form with a keygen field:

<form action="demo_keygen.asp" method="get">
Username: <input type="text" name="usr_name" />
Encryption: <keygen name="security" />
<input type="submit" />
</form>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The <keygen> tag is supported in all major browsers, except Internet Explorer.

Note: Safari supports the <keygen> element on Mac only.


Definition and Usage

The <keygen> tag specifies a key-pair generator field used for forms.

When the form is submitted, the private key is stored locally, and the public key is sent to the server.


Differences Between HTML 4.01 and HTML5

The <keygen> element is new in HTML5.


Attributes

New : New in HTML5.

Attribute Value Description
autofocusNew autofocus Specifies that a <keygen> element should automatically get focus when the page loads
challengeNew challenge Specifies that the value of the <keygen> element should be challenged when submitted
disabledNew disabled Specifies that a <keygen> element should be disabled
formNew form_id Specifies one or more forms the <keygen> element belongs to
keytypeNew rsa
dsa
ec
Specifies the security algorithm of the key
nameNew name Defines a name for the <keygen> element

Global Attributes

The <keygen> tag also supports the Global Attributes in HTML5.


Event Attributes

The <keygen> tag also supports the Event Attributes in HTML5.


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE