PGPPublicKeyRingCollection pgpRings = new PGPPublicKeyRingCollection(keyIn);
PGPObjectFactory pgpFact = new PGPObjectFactory(aIn);
PGPSignatureList p3 = (PGPSignatureList)pgpFact.nextObject();
PGPSignature sig = p3.get(0);
sig.initVerify(pgpRings.getPublicKey(sig.getKeyID()), "BC");
//
// read the input, making sure we ingore the last newline.
//
InputStream sigIn = new BufferedInputStream(new FileInputStream(resultName));
lookAhead = readInputLine(lineOut, sigIn);
processLine(sig, lineOut.toByteArray());
if (lookAhead != -1)
{
do
{
lookAhead = readInputLine(lineOut, lookAhead, sigIn);
sig.update((byte)'\r');
sig.update((byte)'\n');
processLine(sig, lineOut.toByteArray());
}
while (lookAhead != -1);
}
if (sig.verify())
{
System.out.println("signature verified.");
}
else
{