1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-06-13 23:24:52 +02:00

Throw UnacceptableAlgEx for unencrypted encData

This commit is contained in:
Paul Schaub 2022-10-20 16:13:18 +02:00
parent 3d5916c545
commit a9993fd866

View file

@ -480,7 +480,10 @@ public class OpenPgpMessageInputStream extends DecryptionStream {
return false;
}
private boolean decryptPKESKAndStream(SubkeyIdentifier subkeyIdentifier, PublicKeyDataDecryptorFactory decryptorFactory, PGPPublicKeyEncryptedData pkesk) throws IOException {
private boolean decryptPKESKAndStream(SubkeyIdentifier subkeyIdentifier,
PublicKeyDataDecryptorFactory decryptorFactory,
PGPPublicKeyEncryptedData pkesk)
throws IOException, UnacceptableAlgorithmException {
try {
InputStream decrypted = pkesk.getDataStream(decryptorFactory);
SessionKey sessionKey = new SessionKey(pkesk.getSessionKey(decryptorFactory));
@ -495,6 +498,8 @@ public class OpenPgpMessageInputStream extends DecryptionStream {
IntegrityProtectedInputStream integrityProtected = new IntegrityProtectedInputStream(decrypted, pkesk, options);
nestedInputStream = new OpenPgpMessageInputStream(buffer(integrityProtected), options, encryptedData, policy);
return true;
} catch (UnacceptableAlgorithmException e) {
throw e;
} catch (PGPException e) {
}