public interface Mac
Message Authentication Codes provide symmetric message authentication. Instances implementing this interface are secure against existential forgery under chosen plaintext attack, and can be deterministic or randomized. This interface should be used for authentication only, and not for other purposes like generation of pseudorandom bytes.
| Modifier and Type | Method and Description |
|---|---|
byte[] |
computeMac(byte[] data)
Computes message authentication code (MAC) for
data. |
void |
verifyMac(byte[] mac,
byte[] data)
Verifies whether
mac is a correct authentication code (MAC) for data. |
byte[] computeMac(byte[] data)
throws GeneralSecurityException
data.GeneralSecurityExceptionvoid verifyMac(byte[] mac,
byte[] data)
throws GeneralSecurityException
mac is a correct authentication code (MAC) for data.GeneralSecurityException - if mac is not a correct MAC for data