Class Keygen


@Marshalled(typeName="keygen") public class Keygen extends HtmlElementVoid<Keygen>
DTO for an HTML <keygen> element.

The keygen element represents a key-pair generator control for forms. It generates a public/private key pair and submits the public key to the server. This element is deprecated in HTML5 and should not be used in new projects. Modern web applications should use Web Crypto API instead.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Basic keygen with RSA key type Keygen keygen1 = keygen() .name("userkey") .keytype("RSA"); // Keygen with challenge string Keygen keygen2 = keygen() .name("certkey") .keytype("RSA") .challenge("server-challenge-string"); // Keygen with form association Keygen keygen3 = keygen() .name("formkey") .keytype("DSA") .form("myform"); // Keygen with disabled state Keygen keygen4 = keygen() .name("disabledkey") .keytype("RSA") .disabled(true);

The following convenience methods are provided for constructing instances of this bean:

See Also:
  • Constructor Details

  • Method Details

    • autofocus

      public Keygen autofocus(Object value)
      autofocus attribute.

      Automatically focus the form control when the page is loaded.

      Parameters:
      value - The new value for this attribute. Typically a Boolean or String. Can be null to unset the attribute.
      Returns:
      This object.
    • challenge

      public Keygen challenge(String value)
      challenge attribute.

      Specifies a challenge string that will be packaged with the generated and signed public key. This is used for additional security in key generation processes.

      The challenge string is typically provided by the server and used to verify the key generation.

      Parameters:
      value - The challenge string to package with the generated key. Can be null to unset the attribute.
      Returns:
      This object.
    • disabled

      public Keygen disabled(Object value)
      disabled attribute.

      Whether the form control is disabled.

      This attribute uses deminimized values:

      • false - Attribute is not added
      • true - Attribute is added as "disabled"
      • Other values - Passed through as-is
      Parameters:
      value - The new value for this attribute. Typically a Boolean or String. Can be null to unset the attribute.
      Returns:
      This object.
    • form

      public Keygen form(String value)
      form attribute.

      Associates the keygen element with a form element by specifying the form's ID. This allows the keygen to be placed outside the form element while still being part of the form.

      The value should match the ID of a form element in the same document.

      Parameters:
      value - The ID of the form element to associate with this keygen. Can be null to unset the attribute.
      Returns:
      This object.
    • keytype

      public Keygen keytype(String value)
      keytype attribute.

      Specifies the type of cryptographic key to generate.

      Common values:

      • "RSA" - RSA key pair (default)
      • "DSA" - DSA key pair
      • "EC" - Elliptic curve key pair
      Parameters:
      value - The type of cryptographic key to generate. Can be null to unset the attribute.
      Returns:
      This object.
    • name

      public Keygen name(String value)
      name attribute.

      Specifies the name of the keygen element. This name is used when the form is submitted and can be used to access the element via the form.elements API.

      The name should be unique within the form and should not contain spaces or special characters.

      Parameters:
      value - The name of the keygen element for submission and API access. Can be null to unset the attribute.
      Returns:
      This object.