[
https://issues.apache.org/jira/browse/CAMEL-7253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13915393#comment-13915393
]
Willem Jiang commented on CAMEL-7253:
-------------------------------------
Hi Franz,
I think here is a code error in your patch in the patched
PGPKeyAccessDataFormat.
You add two same check of "o instanceof PGPEncryptedDataList" in a if ... else
block.
{code}
@SuppressWarnings("resource")
public Object unmarshal(Exchange exchange, InputStream encryptedStream)
throws Exception {
if (encryptedStream == null) {
return null;
}
InputStream in = PGPUtil.getDecoderStream(encryptedStream);
PGPObjectFactory pgpFactory = new PGPObjectFactory(in);
Object o = pgpFactory.nextObject();
// the first object might be a PGP marker packet
PGPEncryptedDataList enc;
if (o instanceof PGPEncryptedDataList) {
enc = (PGPEncryptedDataList) o;
} else if (o instanceof PGPEncryptedDataList) {
enc = (PGPEncryptedDataList) pgpFactory.nextObject();
} else {
enc = null;
}
{code}
> PGPDataFormat: NullPointerException if decryptor gets body with invalid format
> ------------------------------------------------------------------------------
>
> Key: CAMEL-7253
> URL: https://issues.apache.org/jira/browse/CAMEL-7253
> Project: Camel
> Issue Type: Bug
> Components: camel-crypto
> Reporter: Franz Forsthofer
> Assignee: Willem Jiang
> Attachments: 0001-pgp-NullPointer-exception-if-incorrect-input.patch
>
>
> if the PGPDataFormat gets an invalid format during the decryption process a
> NullPointerException is thrown.
> The attached patch throws an IllegalArgumentException instead and improves
> further error situations if a wrong formated input is provided.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)