Latest web development tutorials

HTML5 <keygen> tag

Examples

With keygen field form:

<form action="demo_keygen.asp" method="get">
用户名: <input type="text" name="usr_name">
加密: <keygen name="security">
<input type="submit">
</form>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Firefox, Opera, Chrome and Safari 6 supports <keygen> tag.


Tag definitions and instructions

<Keygen> tag is used to form a predetermined key pair generator field.

When submitting a form, sent to the server private key is stored in the local public.


Differences between HTML 4.01 and HTML5

<Keygen> element is the new HTML5 tags.


Attributes

New: HTML5 new property.

属性 描述
autofocus New autofocus 使 <keygen> 字段在页面加载时获得焦点。
challenge New challenge 如果使用,则将 keygen 的值设置为在提交时询问。
disabled New disabled 禁用 <keygen> 元素字段。
form New form_id 定义该 <keygen> 字段所属的一个或多个表单。
keytype New rsa
dsa
ec
定义密钥的安全算法。
name New name 定义 <keygen> 元素的唯一名称。 name 属性用于在提交表单时搜集字段的值。

Global Properties

<keygen> tag supports the global attributes, view complete the property sheet HTML Global Attributes .


Event Properties

<keygen> tag supports all HTML event attributes .