// Get the public key from the key pair in the last example.
ECPublicKey publicKey = keyPair.getECPublicKey();
// Set up the ECDSASignatureVerifier.
ECDSASignatureVerifier verifier = new ECDSASignatureVerifier( publicKey,
new MD5Digest(), r, 0, s, 0 );
// Set up the input stream (using contents from above).
ByteArrayInputStream inputStream = new ByteArrayInputStream( contents );
// Use this to set up the SignatureVerifierInputStream
SignatureVerifierInputStream verifierStream =
new SignatureVerifierInputStream( verifier, inputStream );
// Read the data from the stream.
byte[] data = new byte[verifierStream.available()];
verifierStream.read( data );
// Use the verifier to check if the signature is correct.
boolean result = verifier.verify();
// Print out the result.
System.out.println("Signature verification was " + result + ".");