Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML5 tag

HTML tag

This tag has been deprecated in the new web standards.

Alternatives include:

  1. Generate keys in JavaScript using the Web Cryptography API

  2. Use a dedicated cryptography library

  3. Example

    A form with a keygen field:

      Username:

      Encryption:

     

    Try it »


    Browser support

    Internet Explorer Firefox Opera Google Chrome Safari

    Supported by Firefox, Opera, Chrome, and Safari 6 tag.


    Tag Definition and Usage Notes

    The tag specifies a key-pair generator field 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 element is new in HTML5.


    property

    New: new attribute in HTML5.

    property Value Description
    autofocusNew autofocus Make The field receives focus when the page loads.
    challengeNew challenge If used, sets the keygen value to "ask" on submission.
    disabledNew disabled Disables the element field.
    formNew form_id Defines the one or more forms to which the field belongs.
    keytypeNew rsa
     dsa       
    
     ec | 定义密钥的安全算法。 |
    
    

    | nameNew | name | Defines the the unique name of the element. The name attribute is used to collect the field's value when the form is submitted. |

    Global Attributes

    The tag supports global attributes; see the full list in HTML Global Attributes.


    Event attribute

    The tag supports all HTML Event Attributes.