/** * Processes the first <code>len</code> bytes in <code>input</code>, starting at <code>offset * </code>. * * @param input the input buffer. * @param offset the offset in <code>input</code> where the input starts. * @param len the number of bytes to process. */ protected void engineUpdate(byte input[], int offset, int len) { hmac.update(input, offset, len); }
protected void engineUpdate(ByteBuffer input) { hmac.update(input); }
/** * Processes the given byte. * * @param input the input byte to be processed. */ protected void engineUpdate(byte input) { hmac.update(input); }
/** * Initializes the HMAC with the given secret key and algorithm parameters. * * @param key the secret key. * @param params the algorithm parameters. * @exception InvalidKeyException if the given key is inappropriate for initializing this MAC. * @exception InvalidAlgorithmParameterException if the given algorithm parameters are * inappropriate for this MAC. */ protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException { hmac.init(key, params); }
/** * Returns the length of the HMAC in bytes. * * @return the HMAC length in bytes. */ protected int engineGetMacLength() { return hmac.getDigestLength(); }
/** * Resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with. */ protected void engineReset() { hmac.reset(); }
/** * Completes the HMAC computation and resets the HMAC for further use, maintaining the secret key * that the HMAC was initialized with. * * @return the HMAC result. */ protected byte[] engineDoFinal() { return hmac.doFinal(); }