Package com.google.crypto.tink
Interface Mac
-
- All Known Implementing Classes:
LegacyFullMac,PrfMac
public interface MacInterface for Message Authentication Codes (MAC).Security guarantees
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.
- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]computeMac(byte[] data)Computes message authentication code (MAC) fordata.voidverifyMac(byte[] mac, byte[] data)Verifies whethermacis a correct authentication code (MAC) fordata.
-
-
-
Method Detail
-
computeMac
byte[] computeMac(byte[] data) throws java.security.GeneralSecurityExceptionComputes message authentication code (MAC) fordata.- Returns:
- MAC value
- Throws:
java.security.GeneralSecurityException
-
verifyMac
void verifyMac(byte[] mac, byte[] data) throws java.security.GeneralSecurityExceptionVerifies whethermacis a correct authentication code (MAC) fordata.- Throws:
java.security.GeneralSecurityException- ifmacis not a correct MAC fordata
-
-