001// SPDX-FileCopyrightText: 2018 Paul Schaub <vanitasvitae@fsfe.org>
002//
003// SPDX-License-Identifier: Apache-2.0
004
005package org.pgpainless.decryption_verification;
006
007import java.io.IOException;
008import java.io.InputStream;
009import javax.annotation.Nonnull;
010
011import org.bouncycastle.openpgp.PGPException;
012
013public interface DecryptionBuilderInterface {
014
015    /**
016     * Create a {@link DecryptionStream} on an {@link InputStream} which contains the encrypted and/or signed data.
017     *
018     * @param inputStream encrypted and/or signed data.
019     * @return api handle
020     */
021    DecryptWith onInputStream(@Nonnull InputStream inputStream);
022
023    interface DecryptWith {
024
025        /**
026         * Add options for decryption / signature verification, such as keys, passphrases etc.
027         *
028         * @param consumerOptions consumer options
029         * @return decryption stream
030         * @throws PGPException in case of an OpenPGP related error
031         * @throws IOException in case of an IO error
032         */
033        DecryptionStream withOptions(ConsumerOptions consumerOptions) throws PGPException, IOException;
034
035    }
036}