Enum HMACSigningAlgorithm
- java.lang.Object
-
- java.lang.Enum<HMACSigningAlgorithm>
-
- org.smallmind.nutsnbolts.security.HMACSigningAlgorithm
-
- All Implemented Interfaces:
Serializable,Comparable<HMACSigningAlgorithm>,SecurityAlgorithm,SigningAlgorithm
public enum HMACSigningAlgorithm extends Enum<HMACSigningAlgorithm> implements SecurityAlgorithm, SigningAlgorithm
-
-
Enum Constant Summary
Enum Constants Enum Constant Description HMAC_MD5HMAC_SHA_1HMAC_SHA_256
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KeygenerateKey(byte[] secret)StringgetAlgorithmName()byte[]sign(Key key, byte[] data)static HMACSigningAlgorithmvalueOf(String name)Returns the enum constant of this type with the specified name.static HMACSigningAlgorithm[]values()Returns an array containing the constants of this enum type, in the order they are declared.booleanverify(Key key, String[] parts, boolean urlSafe)-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface org.smallmind.nutsnbolts.security.SigningAlgorithm
verify
-
-
-
-
Enum Constant Detail
-
HMAC_MD5
public static final HMACSigningAlgorithm HMAC_MD5
-
HMAC_SHA_1
public static final HMACSigningAlgorithm HMAC_SHA_1
-
HMAC_SHA_256
public static final HMACSigningAlgorithm HMAC_SHA_256
-
-
Method Detail
-
values
public static HMACSigningAlgorithm[] 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 (HMACSigningAlgorithm c : HMACSigningAlgorithm.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static HMACSigningAlgorithm 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
-
getAlgorithmName
public String getAlgorithmName()
- Specified by:
getAlgorithmNamein interfaceSecurityAlgorithm
-
generateKey
public Key generateKey(byte[] secret)
-
sign
public byte[] sign(Key key, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException
- Specified by:
signin interfaceSigningAlgorithm- Throws:
NoSuchAlgorithmExceptionInvalidKeyException
-
verify
public boolean verify(Key key, String[] parts, boolean urlSafe) throws IOException, NoSuchAlgorithmException, InvalidKeyException
- Specified by:
verifyin interfaceSigningAlgorithm- Throws:
IOExceptionNoSuchAlgorithmExceptionInvalidKeyException
-
-