All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aQute.libg.cryptography.Verifier Maven / Gradle / Ivy

Go to download

A command line utility and Ant plugin to wrap, build, or examine bundles.

There is a newer version: 2.4.0
Show newest version
package aQute.libg.cryptography;

import java.io.*;
import java.security.*;

public class Verifier extends OutputStream {
	final Signature	signature;
	final Digest	d;

	Verifier(Signature s, Digest d) {
		this.signature = s;
		this.d = d;
	}

	@Override
	public void write(byte[] buffer, int offset, int length) throws IOException {
		try {
			signature.update(buffer, offset, length);
		}
		catch (SignatureException e) {
			throw new IOException(e.getLocalizedMessage());
		}
	}

	@Override
	public void write(int b) throws IOException {
		try {
			signature.update((byte) b);
		}
		catch (SignatureException e) {
			throw new IOException(e.getLocalizedMessage());
		}
	}

	public boolean verify() throws Exception {
		return signature.verify(d.digest());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy