1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 14:22:05 +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 @Override
public Ready plaintext(InputStream plaintext) throws IOException { public Ready plaintext(InputStream plaintext) throws IOException {
if (!encryptionOptions.hasEncryptionMethod()) {
throw new SOPGPException.MissingArg("Missing encryption method.");
}
ProducerOptions producerOptions = signingOptions != null ? ProducerOptions producerOptions = signingOptions != null ?
ProducerOptions.signAndEncrypt(encryptionOptions, signingOptions) : ProducerOptions.signAndEncrypt(encryptionOptions, signingOptions) :
ProducerOptions.encrypt(encryptionOptions); ProducerOptions.encrypt(encryptionOptions);