Enum DigestScheme.DigestAlgorithm

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DigestScheme.DigestAlgorithm>
    Enclosing class:
    DigestScheme

    private static enum DigestScheme.DigestAlgorithm
    extends java.lang.Enum<DigestScheme.DigestAlgorithm>
    Enum representing supported digest algorithms for HTTP Digest Authentication, including session-based variants.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      MD5
      MD5 digest algorithm.
      MD5_SESS
      MD5 digest algorithm with session-based variant.
      SHA_256
      SHA-256 digest algorithm.
      SHA_256_SESS
      SHA-256 digest algorithm with session-based variant.
      SHA_512_256
      SHA-512/256 digest algorithm.
      SHA_512_256_SESS
      SHA-512/256 digest algorithm with session-based variant.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String baseAlgorithm  
      private boolean sessionBased  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DigestAlgorithm​(java.lang.String baseAlgorithm, boolean sessionBased)
      Constructor for DigestAlgorithm.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static DigestScheme.DigestAlgorithm fromString​(java.lang.String algorithm)
      Maps a string representation of an algorithm to the corresponding enum constant.
      private java.lang.String getBaseAlgorithm()
      Retrieves the base algorithm name without session suffix.
      private boolean isSessionBased()
      Checks if the algorithm is session-based.
      static DigestScheme.DigestAlgorithm valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static DigestScheme.DigestAlgorithm[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • baseAlgorithm

        private final java.lang.String baseAlgorithm
      • sessionBased

        private final boolean sessionBased
    • Constructor Detail

      • DigestAlgorithm

        private DigestAlgorithm​(java.lang.String baseAlgorithm,
                                boolean sessionBased)
        Constructor for DigestAlgorithm.
        Parameters:
        baseAlgorithm - the base name of the algorithm, e.g., "MD5" or "SHA-256"
        sessionBased - indicates if the algorithm is session-based (i.e., includes the "-sess" suffix)
    • Method Detail

      • values

        public static DigestScheme.DigestAlgorithm[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DigestScheme.DigestAlgorithm c : DigestScheme.DigestAlgorithm.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DigestScheme.DigestAlgorithm valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getBaseAlgorithm

        private java.lang.String getBaseAlgorithm()
        Retrieves the base algorithm name without session suffix.
        Returns:
        the base algorithm name
      • isSessionBased

        private boolean isSessionBased()
        Checks if the algorithm is session-based.
        Returns:
        true if the algorithm includes the "-sess" suffix, otherwise false
      • fromString

        private static DigestScheme.DigestAlgorithm fromString​(java.lang.String algorithm)
        Maps a string representation of an algorithm to the corresponding enum constant.
        Parameters:
        algorithm - the algorithm name, e.g., "SHA-256" or "SHA-512-256-sess"
        Returns:
        the corresponding DigestAlgorithm constant
        Throws:
        UnsupportedDigestAlgorithmException - if the algorithm is unsupported