PGPException {
final ByteArrayInputStream keyIn = new ByteArrayInputStream(
publicKeyRing);
final InputStream decoderInputStream = PGPUtil.getDecoderStream(inputStream);
PGPObjectFactory pgpFact = new JcaPGPObjectFactory(decoderInputStream);
final PGPCompressedData c1 = (PGPCompressedData) pgpFact.nextObject();
pgpAssertNotNull(c1);
pgpFact = new JcaPGPObjectFactory(c1.getDataStream());
final PGPOnePassSignatureList p1 = (PGPOnePassSignatureList) pgpFact
.nextObject();
pgpAssertNotNull(p1);
final PGPOnePassSignature ops = p1.get(0);
final PGPLiteralData p2 = (PGPLiteralData) pgpFact.nextObject();
pgpAssertNotNull(p2);
final InputStream dIn = p2.getInputStream();
pgpAssertNotNull(dIn);
int ch;
final PGPPublicKeyRingCollection pgpRing = new PGPPublicKeyRingCollection(
PGPUtil.getDecoderStream(keyIn));
pgpAssertNotNull(ops);
decodeKeyId = ops.getKeyID();
if (decodeKeyId == null) {
// there is no key in the key ring that can decode the license
verified = false;
licenseProperties = null;
} else {
final PGPPublicKey decodeKey = pgpRing.getPublicKey(decodeKeyId);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
final PGPContentVerifierBuilderProvider cvBuilder = new JcaPGPContentVerifierBuilderProvider();
ops.init(cvBuilder, decodeKey);
while ((ch = dIn.read()) >= 0) {
ops.update((byte) ch);
out.write(ch);
}
final PGPSignatureList p3 = (PGPSignatureList) pgpFact
.nextObject();
if (ops.verify(p3.get(0))) {
setLicense(new String(out.toByteArray()));
verified = true;