2021-10-07 15:48:52 +02:00
|
|
|
// SPDX-FileCopyrightText: 2018 Paul Schaub <vanitasvitae@fsfe.org>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-07-18 18:23:06 +02:00
|
|
|
package org.pgpainless.decryption_verification;
|
2018-06-04 14:50:09 +02:00
|
|
|
|
2018-06-06 18:46:41 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
2020-01-10 18:46:31 +01:00
|
|
|
import javax.annotation.Nonnull;
|
2018-06-04 14:50:09 +02:00
|
|
|
|
2018-06-06 18:46:41 +02:00
|
|
|
import org.bouncycastle.openpgp.PGPException;
|
|
|
|
|
|
|
|
public class DecryptionBuilder implements DecryptionBuilderInterface {
|
|
|
|
|
|
|
|
private InputStream inputStream;
|
2020-08-24 14:55:06 +02:00
|
|
|
|
2018-06-06 18:46:41 +02:00
|
|
|
@Override
|
2020-08-24 16:44:14 +02:00
|
|
|
public DecryptWith onInputStream(@Nonnull InputStream inputStream) {
|
2018-06-06 18:46:41 +02:00
|
|
|
this.inputStream = inputStream;
|
|
|
|
return new DecryptWithImpl();
|
|
|
|
}
|
|
|
|
|
|
|
|
class DecryptWithImpl implements DecryptWith {
|
|
|
|
|
2021-06-15 17:08:40 +02:00
|
|
|
@Override
|
|
|
|
public DecryptionStream withOptions(ConsumerOptions consumerOptions) throws PGPException, IOException {
|
|
|
|
if (consumerOptions == null) {
|
|
|
|
throw new IllegalArgumentException("Consumer options cannot be null.");
|
|
|
|
}
|
|
|
|
|
|
|
|
return DecryptionStreamFactory.create(inputStream, consumerOptions);
|
|
|
|
}
|
2018-06-06 18:46:41 +02:00
|
|
|
}
|
2018-06-04 14:50:09 +02:00
|
|
|
}
|