public class HMAC extends Object
Constructor and Description |
---|
HMAC() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
compute(SecretKey secretKey,
byte[] message)
Computes a Hash-based Message Authentication Code (HMAC) for the specified (shared) secret key and message.
|
static byte[] |
compute(String alg,
byte[] secret,
byte[] message)
Computes a Hash-based Message Authentication Code (HMAC) for the specified (shared) secret and message.
|
public static byte[] compute(String alg, byte[] secret, byte[] message)
alg
- The Java Cryptography Architecture (JCA) HMAC algorithm name. Must not be null
.secret
- The (shared) secret. Must not be null
.message
- The message. Must not be null
.RuntimeException
- If the algorithm is not supported or the MAC secret key is invalid.public static byte[] compute(SecretKey secretKey, byte[] message)
secretKey
- The (shared) secret key, with the appropriate HMAC algorithm. Must not be null
.message
- The message. Must not be null
.RuntimeException
- If the algorithm is not supported or the MAC secret key is invalid.Copyright © 2014. All rights reserved.