mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
GPGSignatureVerification: better error handling when reading signature
This commit is contained in:
parent
0c123d7d14
commit
060ec30e1c
@ -58,7 +58,16 @@ public class GPGDetachedSignatureVerifier {
|
||||
signatureInputStream = new FileInputStream(signature);
|
||||
PGPObjectFactory pgpObjectFactory = new PGPObjectFactory(signatureInputStream, new BcKeyFingerprintCalculator());
|
||||
|
||||
PGPSignatureList pgpSignatureList = (PGPSignatureList) pgpObjectFactory.nextObject();
|
||||
Object nextObject;
|
||||
try {
|
||||
nextObject = pgpObjectFactory.nextObject();
|
||||
if (!(nextObject instanceof PGPSignatureList)) {
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
PGPSignatureList pgpSignatureList = (PGPSignatureList) nextObject;
|
||||
assert pgpSignatureList.size() == 1;
|
||||
PGPSignature pgpSignature = pgpSignatureList.get(0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user