Class JceTlsHMAC
- java.lang.Object
-
- org.bouncycastle.tls.crypto.impl.jcajce.JceTlsHMAC
-
-
Constructor Summary
Constructors Constructor Description JceTlsHMAC(javax.crypto.Mac hmac, java.lang.String algorithm)Base constructor.JceTlsHMAC(javax.crypto.Mac hmac, java.lang.String algorithm, int internalBlockSize)Base constructor specifying the internal block size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]calculateMAC()Return calculated MAC for any input passed in.voidcalculateMAC(byte[] output, int outOff)Write the calculated MAC to an output buffer.intgetInternalBlockSize()Return the internal block size for the message digest underlying this HMAC service.intgetMacLength()Return the length of the MAC generated by this service.voidreset()Reset the MAC underlying this service.voidsetKey(byte[] key, int keyOff, int keyLen)Set the key to be used by the MAC implementation supporting this service.voidupdate(byte[] input, int inOff, int length)Update the MAC with the passed in input.
-
-
-
Constructor Detail
-
JceTlsHMAC
public JceTlsHMAC(javax.crypto.Mac hmac, java.lang.String algorithm)Base constructor.- Parameters:
hmac- MAC implementation.algorithm- algorithm name to use for keys and to get the internal block size.
-
JceTlsHMAC
public JceTlsHMAC(javax.crypto.Mac hmac, java.lang.String algorithm, int internalBlockSize)Base constructor specifying the internal block size.- Parameters:
hmac- MAC implementation.algorithm- algorithm name to use for keys and to get the internal block size.internalBlockSize- internal block size of the message digest underlying the HMAC.
-
-
Method Detail
-
setKey
public void setKey(byte[] key, int keyOff, int keyLen)Description copied from interface:TlsMACSet the key to be used by the MAC implementation supporting this service.
-
update
public void update(byte[] input, int inOff, int length)Description copied from interface:TlsMACUpdate the MAC with the passed in input.
-
calculateMAC
public byte[] calculateMAC()
Description copied from interface:TlsMACReturn calculated MAC for any input passed in.- Specified by:
calculateMACin interfaceTlsMAC- Returns:
- the MAC value.
-
calculateMAC
public void calculateMAC(byte[] output, int outOff)Description copied from interface:TlsMACWrite the calculated MAC to an output buffer.- Specified by:
calculateMACin interfaceTlsMAC- Parameters:
output- output array to write the MAC to.outOff- offset into the output array to write the MAC to.
-
getInternalBlockSize
public int getInternalBlockSize()
Description copied from interface:TlsHMACReturn the internal block size for the message digest underlying this HMAC service.- Specified by:
getInternalBlockSizein interfaceTlsHMAC- Returns:
- the internal block size for the digest (in bytes).
-
getMacLength
public int getMacLength()
Description copied from interface:TlsMACReturn the length of the MAC generated by this service.- Specified by:
getMacLengthin interfaceTlsMAC- Returns:
- the MAC length.
-
-