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 verify a signature based 9 * on data in a stream of output. 10 */ 11 public interface ContentVerifier 12 { 13 /** 14 * Return the algorithm identifier describing the signature 15 * algorithm and parameters this verifier supports. 16 * 17 * @return algorithm oid and parameters. 18 */ getAlgorithmIdentifier()19 AlgorithmIdentifier getAlgorithmIdentifier(); 20 21 /** 22 * Returns a stream that will accept data for the purpose of calculating 23 * a signature for later verification. 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 true if the expected value of the signature matches the data passed 32 * into the stream. 33 * 34 * @param expected expected value of the signature on the data. 35 * @return true if the signature verifies, false otherwise 36 */ verify(byte[] expected)37 boolean verify(byte[] expected); 38 }