Interface GordianMac
- All Superinterfaces:
GordianConsumer
GordianKnot interface for Message Authentication Codes.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]finish()Calculate the MAC.default byte[]finish(byte[] pBytes) Update the MAC, calculate and reset it.intfinish(byte[] pBuffer, int pOffset) Calculate the MAC, and return it in the buffer provided.byte[]Obtain the keyType.getKey()Obtain the key.intObtain the MAC size.Obtain MacSpec.voidinit(GordianMacParameters pParams) Initialise the MAC with the given parameters.voidinitKeyBytes(byte[] pKeyBytes) Init with bytes as key.Methods inherited from interface io.github.tonywasher.joceanus.gordianknot.api.base.GordianConsumer
reset, update, update, update
-
Method Details
-
getMacSpec
GordianMacSpec getMacSpec()Obtain MacSpec.- Returns:
- the MacSpec
-
getKey
GordianKey<GordianMacSpec> getKey()Obtain the key.- Returns:
- the key
-
getInitVector
byte[] getInitVector()Obtain the keyType.- Returns:
- the keyType
-
getMacSize
int getMacSize()Obtain the MAC size.- Returns:
- the MAC size
-
init
Initialise the MAC with the given parameters.- Parameters:
pParams- the parameters- Throws:
GordianException- on error
-
initKeyBytes
Init with bytes as key.- Parameters:
pKeyBytes- the bytes to use- Throws:
GordianException- on error
-
finish
byte[] finish()Calculate the MAC.- Returns:
- the MAC
-
finish
Calculate the MAC, and return it in the buffer provided.- Parameters:
pBuffer- the buffer to return the digest in.pOffset- the offset in the buffer to store the digest.- Returns:
- the number of bytes placed into buffer
- Throws:
GordianException- on error
-
finish
Update the MAC, calculate and reset it.- Parameters:
pBytes- the bytes to update with.- Returns:
- the MAC
- Throws:
GordianException- on error
-