001// SPDX-FileCopyrightText: 2018 Paul Schaub <vanitasvitae@fsfe.org>
002//
003// SPDX-License-Identifier: Apache-2.0
004
005package org.pgpainless.encryption_signing;
006
007import java.io.IOException;
008import java.io.OutputStream;
009import javax.annotation.Nonnull;
010
011import org.bouncycastle.openpgp.PGPException;
012
013public interface EncryptionBuilderInterface {
014
015    /**
016     * Create a {@link EncryptionStream} on an {@link OutputStream} that contains the plain data that
017     * shall be encrypted and or signed.
018     *
019     * @param outputStream output stream of the plain data.
020     * @return api handle
021     */
022    WithOptions onOutputStream(@Nonnull OutputStream outputStream);
023
024    interface WithOptions {
025
026        /**
027         * Create an {@link EncryptionStream} with the given options (recipients, signers, algorithms...).
028         *
029         * @param options options
030         * @return encryption strea
031         */
032        EncryptionStream withOptions(ProducerOptions options) throws PGPException, IOException;
033
034    }
035}