mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-17 09:41:08 +01:00
Add junit test for symmetric decryption
This commit is contained in:
parent
7d374f10a7
commit
c7ede0fc8a
2 changed files with 72 additions and 2 deletions
|
|
@ -201,7 +201,12 @@ public final class DecryptionStreamFactory {
|
|||
pbeEncryptedData.getSymmetricAlgorithm(passphraseDecryptor));
|
||||
resultBuilder.setSymmetricKeyAlgorithm(symmetricKeyAlgorithm);
|
||||
resultBuilder.setIntegrityProtected(pbeEncryptedData.isIntegrityProtected());
|
||||
return pbeEncryptedData.getDataStream(passphraseDecryptor);
|
||||
|
||||
try {
|
||||
return pbeEncryptedData.getDataStream(passphraseDecryptor);
|
||||
} catch (PGPException e) {
|
||||
LOGGER.log(LEVEL, "Probable passphrase mismatch, skip PBE encrypted data block", e);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (encryptedData instanceof PGPPublicKeyEncryptedData) {
|
||||
|
|
@ -225,7 +230,7 @@ public final class DecryptionStreamFactory {
|
|||
}
|
||||
|
||||
if (decryptionKey == null) {
|
||||
throw new PGPException("Decryption failed - No suitable decryption key found");
|
||||
throw new PGPException("Decryption failed - No suitable decryption key or passphrase found");
|
||||
}
|
||||
|
||||
PublicKeyDataDecryptorFactory keyDecryptor = new BcPublicKeyDataDecryptorFactory(decryptionKey);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue