Package com.nimbusds.jose.crypto.impl
Class HMAC
- java.lang.Object
-
- com.nimbusds.jose.crypto.impl.HMAC
-
@ThreadSafe public class HMAC extends java.lang.ObjectStatic methods for Hash-based Message Authentication Codes (HMAC). This class is thread-safe.- Version:
- 2015-04-23
- Author:
- Axel Nennker, Vladimir Dzhuvinov
-
-
Constructor Summary
Constructors Constructor Description HMAC()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]compute(java.lang.String alg, byte[] secret, byte[] message, java.security.Provider provider)Computes a Hash-based Message Authentication Code (HMAC) for the specified secret and message.static byte[]compute(javax.crypto.SecretKey secretKey, byte[] message, java.security.Provider provider)Computes a Hash-based Message Authentication Code (HMAC) for the specified secret key and message.static javax.crypto.MacgetInitMac(javax.crypto.SecretKey secretKey, java.security.Provider provider)
-
-
-
Method Detail
-
getInitMac
public static javax.crypto.Mac getInitMac(javax.crypto.SecretKey secretKey, java.security.Provider provider) throws JOSEException- Throws:
JOSEException
-
compute
public static byte[] compute(java.lang.String alg, byte[] secret, byte[] message, java.security.Provider provider) throws JOSEExceptionComputes 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, ornullto 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(javax.crypto.SecretKey secretKey, byte[] message, java.security.Provider provider) throws JOSEExceptionComputes 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, ornullto use the default one.- Returns:
- A MAC service instance.
- Throws:
JOSEException- If the algorithm is not supported or the MAC secret key is invalid.
-
-