Package com.nimbusds.jose.crypto.impl
Class HMAC
- java.lang.Object
-
- com.nimbusds.jose.crypto.impl.HMAC
-
-
Constructor Summary
Constructors Constructor Description HMAC()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
compute(String alg, byte[] secret, byte[] message, Provider provider)
Computes a Hash-based Message Authentication Code (HMAC) for the specified secret and message.static byte[]
compute(SecretKey secretKey, byte[] message, Provider provider)
Computes a Hash-based Message Authentication Code (HMAC) for the specified secret key and message.static Mac
getInitMac(SecretKey secretKey, Provider provider)
-
-
-
Constructor Detail
-
HMAC
public HMAC()
-
-
Method Detail
-
getInitMac
public static Mac getInitMac(SecretKey secretKey, Provider provider) throws JOSEException
- Throws:
JOSEException
-
compute
public static byte[] compute(String alg, byte[] secret, byte[] message, Provider provider) throws JOSEException
Computes a Hash-based Message Authentication Code (HMAC) for the specified secret and message.- Parameters:
alg
- The Java Cryptography Architecture (JCA) HMAC algorithm name. Must not benull
.secret
- The secret. Must not benull
.message
- The message. Must not benull
.provider
- The JCA provider, ornull
to use the default one.- Returns:
- A MAC service instance.
- Throws:
JOSEException
- If the algorithm is not supported or the MAC secret key is invalid.
-
compute
public static byte[] compute(SecretKey secretKey, byte[] message, Provider provider) throws JOSEException
Computes a Hash-based Message Authentication Code (HMAC) for the specified secret key and message.- Parameters:
secretKey
- The secret key, with the appropriate HMAC algorithm. Must not benull
.message
- The message. Must not benull
.provider
- The JCA provider, ornull
to use the default one.- Returns:
- A MAC service instance.
- Throws:
JOSEException
- If the algorithm is not supported or the MAC secret key is invalid.
-
-