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 an operator that is able to calculate a digest from 9 * a stream of output. 10 */ 11 public interface DigestCalculator 12 { 13 /** 14 * Return the algorithm identifier representing the digest implemented by 15 * this calculator. 16 * 17 * @return algorithm id and parameters. 18 */ getAlgorithmIdentifier()19 AlgorithmIdentifier getAlgorithmIdentifier(); 20 21 /** 22 * Returns a stream that will accept data for the purpose of calculating 23 * a digest. Use org.bouncycastle.util.io.TeeOutputStream if you want to accumulate 24 * the data on the fly as well. 25 * 26 * @return an OutputStream 27 */ getOutputStream()28 OutputStream getOutputStream(); 29 30 /** 31 * Return the digest calculated on what has been written to the calculator's output stream. 32 * 33 * @return a digest. 34 */ getDigest()35 byte[] getDigest(); 36 } 37