Package com.authlete.common.types
Enum JWSAlg
- java.lang.Object
-
- java.lang.Enum<JWSAlg>
-
- com.authlete.common.types.JWSAlg
-
- All Implemented Interfaces:
Serializable,Comparable<JWSAlg>
public enum JWSAlg extends Enum<JWSAlg>
"alg"(Algorithm) Header Parameter Values for JWS.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EdDSA"EdDSA"(14); EdDSA signature algorithms.ES256"ES256"(7); ECDSA using P-256 and SHA-256.ES256K"ES256K"(13); ECDSA using secp256k1 curve and SHA-256.ES384"ES384"(8); ECDSA using P-384 and SHA-384.ES512"ES512"(9); ECDSA using P-521 and SHA-512.HS256"HS256"(1); HMAC using SHA-256.HS384"HS384"(2); HMAC using SHA-384.HS512"HS512"(3); HMAC using SHA-512.NONE"none"(0); No digital signature or MAC performed.PS256"PS256"(10); RSASSA-PSS using SHA-256 and MGF1 with SHA-256.PS384"PS384"(11); RSASSA-PSS using SHA-384 and MGF1 with SHA-384.PS512"PS512"(12); RSASSA-PSS using SHA-512 and MGF1 with SHA-512.RS256"RS256"(4); RSASSA-PKCS-v1_5 using SHA-256.RS384"RS384"(5); RSASSA-PKCS-v1_5 using SHA-384.RS512"RS512"(6); RSASSA-PKCS-v1_5 using SHA-512.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JWSAlggetByValue(short value)Find an instance of this enum by a value.HashAlggetHashAlg()Get the hash algorithm used by this signature algorithm.StringgetName()Get the name of this algorithm.shortgetValue()Get the integer representation of this enum instance.booleanisAsymmetric()Check if this algorithm is an asymmetric one.static booleanisAsymmetric(JWSAlg alg)Check if the given JWS algorithm is an asymmetric one.booleanisSymmetric()Check if this algorithm is a symmetric one.static booleanisSymmetric(JWSAlg alg)Check if the given JWS algorithm is a symmetric one.static JWSAlgparse(String alg)ConvertStringtoJWSAlg.static JWSAlg[]toArray(int bits)static inttoBits(EnumSet<JWSAlg> set)static EnumSet<JWSAlg>toSet(int bits)static EnumSet<JWSAlg>toSet(JWSAlg[] array)StringtoString()static JWSAlgvalueOf(String name)Returns the enum constant of this type with the specified name.static JWSAlg[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NONE
public static final JWSAlg NONE
"none"(0); No digital signature or MAC performed.
-
HS256
public static final JWSAlg HS256
"HS256"(1); HMAC using SHA-256.
-
HS384
public static final JWSAlg HS384
"HS384"(2); HMAC using SHA-384.
-
HS512
public static final JWSAlg HS512
"HS512"(3); HMAC using SHA-512.
-
RS256
public static final JWSAlg RS256
"RS256"(4); RSASSA-PKCS-v1_5 using SHA-256.
-
RS384
public static final JWSAlg RS384
"RS384"(5); RSASSA-PKCS-v1_5 using SHA-384.
-
RS512
public static final JWSAlg RS512
"RS512"(6); RSASSA-PKCS-v1_5 using SHA-512.
-
ES256
public static final JWSAlg ES256
"ES256"(7); ECDSA using P-256 and SHA-256.
-
ES384
public static final JWSAlg ES384
"ES384"(8); ECDSA using P-384 and SHA-384.
-
ES512
public static final JWSAlg ES512
"ES512"(9); ECDSA using P-521 and SHA-512.
-
PS256
public static final JWSAlg PS256
"PS256"(10); RSASSA-PSS using SHA-256 and MGF1 with SHA-256.
-
PS384
public static final JWSAlg PS384
"PS384"(11); RSASSA-PSS using SHA-384 and MGF1 with SHA-384.
-
PS512
public static final JWSAlg PS512
"PS512"(12); RSASSA-PSS using SHA-512 and MGF1 with SHA-512.- Since:
- 2.75
-
ES256K
public static final JWSAlg ES256K
"ES256K"(13); ECDSA using secp256k1 curve and SHA-256.
-
EdDSA
public static final JWSAlg EdDSA
"EdDSA"(14); EdDSA signature algorithms.Note: SHA512 is used as has as per the Edwards algorithm in RFC 8032 : Edwards-Curve Digital Signature Algorithm (EdDSA).
-
-
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 nameNullPointerException- if the argument is null
-
getName
public String getName()
Get the name of this algorithm. One of the values listed in the table in 3.1. "alg" (Algorithm) Header Parameter Values for JWS of RFC 7518 is returned.- Returns:
- The name of this algorithm.
- Since:
- 2.17
-
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.
NONEreturnsnull.
-
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
nullif not found.
-
parse
public static JWSAlg parse(String alg)
ConvertStringtoJWSAlg.- Parameters:
alg- Algorithm name. For example,"HS256".- Returns:
JWSAlginstance, ornull.
-
toArray
public static JWSAlg[] toArray(int bits)
-
isSymmetric
public static boolean isSymmetric(JWSAlg alg)
Check if the given JWS algorithm is a symmetric one.
-
isAsymmetric
public static boolean isAsymmetric(JWSAlg alg)
Check if the given JWS algorithm is an asymmetric one.
-
isSymmetric
public boolean isSymmetric()
Check if this algorithm is a symmetric one.
-
-