package aalg.crypto;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * General interface for verifiers that verifies electronic signatures of messages.
 * @author Ing. Petr Ležák
 */
public interface ISignatureVerifier<S extends ISignature, K extends IPublicKey> {
	/**
	 * Verifies signature of given message.
	 * @param message message to verify
	 * @param signature signature signature of the message
	 * @param publicKey public key of the signing entity
	 * @return true if signature is valid, false if not
	 */
	public boolean verify (final byte[] message, final S signature, final K publicKey);

	/**
	 * Reads signature from given stream.
	 * @param stream stream with signature
	 * @return signature
	 */
	public S readSignatureFromStream(final InputStream stream) throws IOException;
}
