1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-22 19:08:00 +01:00

SOP encrypt: Throw MissingArg if no encryption method was provided.

This commit is contained in:
Paul Schaub 2023-01-31 18:20:03 +01:00
parent 695e03f8b6
commit 83ef9cfe80
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -113,6 +113,9 @@ public class EncryptImpl implements Encrypt {
@Override
public Ready plaintext(InputStream plaintext) throws IOException {
if (!encryptionOptions.hasEncryptionMethod()) {
throw new SOPGPException.MissingArg("Missing encryption method.");
}
ProducerOptions producerOptions = signingOptions != null ?
ProducerOptions.signAndEncrypt(encryptionOptions, signingOptions) :
ProducerOptions.encrypt(encryptionOptions);