Package com.authlete.common.types
Enum JWEAlg
- java.lang.Object
-
- java.lang.Enum<JWEAlg>
-
- com.authlete.common.types.JWEAlg
-
- All Implemented Interfaces:
Serializable
,Comparable<JWEAlg>
public enum JWEAlg extends Enum<JWEAlg>
"alg"
(Algorithm) Header Parameter Values for JWE.- Author:
- Takahiko Kawasaki
- See Also:
- RFC 7518, 4.1. "alg" (Algorithm) Header Parameter Values for JWE
-
-
Enum Constant Summary
Enum Constants Enum Constant Description A128GCMKW
"A128GCMKW"
(12); Key wrapping with AES GCM using 128 bit key.A128KW
"A128KW"
(4); AES Key Wrap with default initial value using 128 bit key.A192GCMKW
"A192GCMKW"
(13); Key wrapping with AES GCM using 192 bit key.A192KW
"A192KW"
(5); AES Key Wrap with default initial value using 192 bit key.A256GCMKW
"A256GCMKW"
(14); Key wrapping with AES GCM using 256 bit key.A256KW
"A256KW"
(6); AES Key Wrap with default initial value using 256 bit key.DIR
"dir"
(7); Direct use of a shared symmetric key as the CEK.ECDH_ES
"ECDH-ES"
(8); Elliptic Curve Diffie-Hellman Ephemeral Static key agreement using Concat KDF.ECDH_ES_A128KW
"ECDH-ES+A128KW"
(9); ECDH-ES using Concat KDF and CEK wrapped with "A128KW".ECDH_ES_A192KW
"ECDH-ES+A192KW"
(10); ECDH-ES using Concat KDF and CEK wrapped with "A192KW".ECDH_ES_A256KW
"ECDH-ES+A256KW"
(11); ECDH-ES using Concat KDF and CEK wrapped with "A256KW".PBES2_HS256_A128KW
"PBES2-HS256+A128KW"
(15); PBES2 with HMAC SHA-256 and "A128KW".PBES2_HS384_A192KW
"PBES2-HS384+A192KW"
(16); PBES2 with HMAC SHA-384 and "A192KW".PBES2_HS512_A256KW
"PBES2-HS512+A256KW"
(17); PBES2 with HMAC SHA-512 and "A256KW".RSA_OAEP
"RSA-OAEP"
(2); RSAES OAEP using default parameters.RSA_OAEP_256
"RSA-OAEP-256"
(3); RSAES OAEP using SHA-256 and MGF1 with SHA-256.RSA1_5
"RSA1_5"
(1); RSAES-PKCS1-V1_5.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JWEAlg
getByValue(short value)
Find an instance of this enum by a value.String
getName()
Get the name of this algorithm.short
getValue()
Get the integer representation of this enum instance.boolean
isAsymmetric()
Check if this algorithm is an asymmetric one.static boolean
isAsymmetric(JWEAlg alg)
Check if the given JWE algorithm is an asymmetric one.boolean
isSymmetric()
Check if this algorithm is a symmetric one.static boolean
isSymmetric(JWEAlg alg)
Check if the given JWE algorithm is a symmetric one.static JWEAlg
parse(String alg)
ConvertString
toJWEAlg
.static JWEAlg[]
toArray(int bits)
static int
toBits(EnumSet<JWEAlg> set)
static EnumSet<JWEAlg>
toSet(int bits)
static EnumSet<JWEAlg>
toSet(JWEAlg[] array)
String
toString()
static JWEAlg
valueOf(String name)
Returns the enum constant of this type with the specified name.static JWEAlg[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
RSA1_5
public static final JWEAlg RSA1_5
"RSA1_5"
(1); RSAES-PKCS1-V1_5.
-
RSA_OAEP
public static final JWEAlg RSA_OAEP
"RSA-OAEP"
(2); RSAES OAEP using default parameters.
-
RSA_OAEP_256
public static final JWEAlg RSA_OAEP_256
"RSA-OAEP-256"
(3); RSAES OAEP using SHA-256 and MGF1 with SHA-256.
-
A128KW
public static final JWEAlg A128KW
"A128KW"
(4); AES Key Wrap with default initial value using 128 bit key.
-
A192KW
public static final JWEAlg A192KW
"A192KW"
(5); AES Key Wrap with default initial value using 192 bit key.
-
A256KW
public static final JWEAlg A256KW
"A256KW"
(6); AES Key Wrap with default initial value using 256 bit key.
-
DIR
public static final JWEAlg DIR
"dir"
(7); Direct use of a shared symmetric key as the CEK.
-
ECDH_ES
public static final JWEAlg ECDH_ES
"ECDH-ES"
(8); Elliptic Curve Diffie-Hellman Ephemeral Static key agreement using Concat KDF.
-
ECDH_ES_A128KW
public static final JWEAlg ECDH_ES_A128KW
"ECDH-ES+A128KW"
(9); ECDH-ES using Concat KDF and CEK wrapped with "A128KW".
-
ECDH_ES_A192KW
public static final JWEAlg ECDH_ES_A192KW
"ECDH-ES+A192KW"
(10); ECDH-ES using Concat KDF and CEK wrapped with "A192KW".
-
ECDH_ES_A256KW
public static final JWEAlg ECDH_ES_A256KW
"ECDH-ES+A256KW"
(11); ECDH-ES using Concat KDF and CEK wrapped with "A256KW".
-
A128GCMKW
public static final JWEAlg A128GCMKW
"A128GCMKW"
(12); Key wrapping with AES GCM using 128 bit key.
-
A192GCMKW
public static final JWEAlg A192GCMKW
"A192GCMKW"
(13); Key wrapping with AES GCM using 192 bit key.
-
A256GCMKW
public static final JWEAlg A256GCMKW
"A256GCMKW"
(14); Key wrapping with AES GCM using 256 bit key.
-
PBES2_HS256_A128KW
public static final JWEAlg PBES2_HS256_A128KW
"PBES2-HS256+A128KW"
(15); PBES2 with HMAC SHA-256 and "A128KW".
-
PBES2_HS384_A192KW
public static final JWEAlg PBES2_HS384_A192KW
"PBES2-HS384+A192KW"
(16); PBES2 with HMAC SHA-384 and "A192KW".
-
PBES2_HS512_A256KW
public static final JWEAlg PBES2_HS512_A256KW
"PBES2-HS512+A256KW"
(17); PBES2 with HMAC SHA-512 and "A256KW".
-
-
Method Detail
-
values
public static JWEAlg[] 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 (JWEAlg c : JWEAlg.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JWEAlg 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 4.1. "alg" (Algorithm) Header Parameter Values for JWE 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.
-
getByValue
public static JWEAlg 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 JWEAlg parse(String alg)
ConvertString
toJWEAlg
.- Parameters:
alg
- Algorithm name. For example,"RSA1_5"
.- Returns:
JWEAlg
instance, ornull
.
-
toArray
public static JWEAlg[] toArray(int bits)
-
isSymmetric
public static boolean isSymmetric(JWEAlg alg)
Check if the given JWE algorithm is a symmetric one.- Parameters:
alg
- JWE algorithm.- Returns:
true
if the given JWE algorithm is symmetric. To be concrete,true
is returned whenalg
isA128KW
,A192KW
,A256KW
,DIR
,A128GCMKW
,A192GCMKW
,A256GCMKW
,PBES2_HS256_A128KW
,PBES2_HS384_A192KW
, orPBES2_HS512_A256KW
.- Since:
- 2.28
-
isAsymmetric
public static boolean isAsymmetric(JWEAlg alg)
Check if the given JWE algorithm is an asymmetric one.- Parameters:
alg
- JWE algorithm.- Returns:
true
if the given JWE algorithm is asymmetric. To be concrete,true
is returned whenalg
isRSA1_5
,RSA_OAEP
,RSA_OAEP_256
,ECDH_ES
,ECDH_ES_A128KW
,ECDH_ES_A192KW
, orECDH_ES_A256KW
.- Since:
- 2.28
-
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 isA128KW
,A192KW
,A256KW
,DIR
,A128GCMKW
,A192GCMKW
,A256GCMKW
,PBES2_HS256_A128KW
,PBES2_HS384_A192KW
, orPBES2_HS512_A256KW
.- Since:
- 2.28
-
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 isRSA1_5
,RSA_OAEP
,RSA_OAEP_256
,ECDH_ES
,ECDH_ES_A128KW
,ECDH_ES_A192KW
, orECDH_ES_A256KW
.- Since:
- 2.28
-
-