Enum Class SignatureAlgorithm

java.lang.Object
java.lang.Enum<SignatureAlgorithm>
org.jenkinsci.plugins.github.webhook.SignatureAlgorithm
All Implemented Interfaces:
Serializable, Comparable<SignatureAlgorithm>, Constable

public enum SignatureAlgorithm extends Enum<SignatureAlgorithm>
Enumeration of supported webhook signature algorithms.
Since:
1.45.0
  • Enum Constant Details

    • SHA256

      public static final SignatureAlgorithm SHA256
      SHA-256 HMAC signature validation (recommended). Uses X-Hub-Signature-256 header with sha256= prefix.
    • SHA1

      @Deprecated public static final SignatureAlgorithm SHA1
      Deprecated.
      Use SHA256 for enhanced security
      SHA-1 HMAC signature validation (legacy). Uses X-Hub-Signature header with sha1= prefix.
  • Field Details

    • DEFAULT_ALGORITHM_PROPERTY

      public static final String DEFAULT_ALGORITHM_PROPERTY
      System property to override default signature algorithm. Set to "SHA1" to use legacy SHA-1 as default for backwards compatibility.
      See Also:
  • Method Details

    • values

      public static SignatureAlgorithm[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SignatureAlgorithm valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDefault

      public static SignatureAlgorithm getDefault()
      Gets the default algorithm for new configurations. Defaults to SHA-256 for security, but can be overridden via system property. This is evaluated dynamically to respect system property changes.
      Returns:
      the default algorithm based on current system property
    • getPrefix

      public String getPrefix()
      Returns:
      the prefix used in signature strings (e.g. "sha256", "sha1")
    • getHeaderName

      public String getHeaderName()
      Returns:
      the HTTP header name for this algorithm
    • getJavaAlgorithm

      public String getJavaAlgorithm()
      Returns:
      the Java algorithm name for HMAC computation
    • getSignaturePrefix

      public String getSignaturePrefix()
      Returns:
      the expected signature prefix including equals sign (e.g. "sha256=", "sha1=")