1 package org.bouncycastle.operator; 2 3 import java.io.OutputStream; 4 5 import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 6 7 /** 8 * General interface for a key initialized operator that is able to calculate a MAC from 9 * a stream of output. 10 */ 11 public interface MacCalculator 12 { getAlgorithmIdentifier()13 AlgorithmIdentifier getAlgorithmIdentifier(); 14 15 /** 16 * Returns a stream that will accept data for the purpose of calculating 17 * the MAC for later verification. Use org.bouncycastle.util.io.TeeOutputStream if you want to accumulate 18 * the data on the fly as well. 19 * 20 * @return an OutputStream 21 */ getOutputStream()22 OutputStream getOutputStream(); 23 24 /** 25 * Return the calculated MAC based on what has been written to the stream. 26 * 27 * @return calculated MAC. 28 */ getMac()29 byte[] getMac(); 30 31 32 /** 33 * Return the key used for calculating the MAC. 34 * 35 * @return the MAC key. 36 */ getKey()37 GenericKey getKey(); 38 }