Enum JWSAlg

    • Method Detail

      • values

        public static JWSAlg[] 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 (JWSAlg c : JWSAlg.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JWSAlg valueOf​(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:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getValue

        public short getValue()
        Get the integer representation of this enum instance.
      • getHashAlg

        public HashAlg getHashAlg()
        Get the hash algorithm used by this signature algorithm.
        Returns:
        The hash algorithm. NONE returns null.
      • getByValue

        public static JWSAlg getByValue​(short value)
        Find an instance of this enum by a value.
        Parameters:
        value - The integer representation of the instance to find.
        Returns:
        An instance of this enum, or null if not found.
      • parse

        public static JWSAlg parse​(String alg)
        Convert String to JWSAlg.
        Parameters:
        alg - Algorithm name. For example, "HS256".
        Returns:
        JWSAlg instance, or null.
      • toArray

        public static JWSAlg[] toArray​(int bits)
      • isSymmetric

        public static boolean isSymmetric​(JWSAlg alg)
        Check if the given JWS algorithm is a symmetric one.
        Parameters:
        alg - JWS algorithm.
        Returns:
        true if the given JWS algorithm is symmetric. To be concrete, true is returned when alg is HS256, HS384 or HS512.
        Since:
        2.12
      • isAsymmetric

        public static boolean isAsymmetric​(JWSAlg alg)
        Check if the given JWS algorithm is an asymmetric one.
        Parameters:
        alg - JWS algorithm.
        Returns:
        true if the given JWS algorithm is asymmetric. To be concrete, true is returned when alg is RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384 or ES512.
        Since:
        2.12
      • isSymmetric

        public boolean isSymmetric()
        Check if this algorithm is a symmetric one.
        Returns:
        true if this algorithm is symmetric. To be concrete, true is returned when this is is HS256, HS384 or HS512.
        Since:
        2.16
      • isAsymmetric

        public boolean isAsymmetric()
        Check if this algorithm is an asymmetric one.
        Returns:
        true if this algorithm is asymmetric. To be concrete, true is returned when this is RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384 or ES512.
        Since:
        2.16