pgpainless/src/main/java/de/vanitasvitae/crypto/pgpainless/encryption_signing/EncryptionBuilderInterface....

82 lines
2.8 KiB
Java
Raw Normal View History

2018-06-04 19:45:18 +02:00
package de.vanitasvitae.crypto.pgpainless.encryption_signing;
2018-06-05 01:30:58 +02:00
import java.io.IOException;
2018-06-04 19:45:18 +02:00
import java.io.OutputStream;
import java.util.Set;
import de.vanitasvitae.crypto.pgpainless.PublicKeyNotFoundException;
import de.vanitasvitae.crypto.pgpainless.SecretKeyNotFoundException;
import de.vanitasvitae.crypto.pgpainless.algorithm.CompressionAlgorithm;
import de.vanitasvitae.crypto.pgpainless.algorithm.HashAlgorithm;
import de.vanitasvitae.crypto.pgpainless.algorithm.SymmetricKeyAlgorithm;
2018-06-07 18:12:13 +02:00
import de.vanitasvitae.crypto.pgpainless.key.SecretKeyRingProtector;
2018-06-11 01:33:49 +02:00
import de.vanitasvitae.crypto.pgpainless.key.selection.keyring.PublicKeyRingSelectionStrategy;
import de.vanitasvitae.crypto.pgpainless.key.selection.keyring.SecretKeyRingSelectionStrategy;
import de.vanitasvitae.crypto.pgpainless.util.MultiMap;
2018-06-05 01:30:58 +02:00
import org.bouncycastle.openpgp.PGPException;
2018-06-04 19:45:18 +02:00
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
2018-06-11 01:33:49 +02:00
import org.bouncycastle.openpgp.PGPSecretKey;
2018-06-04 19:45:18 +02:00
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
public interface EncryptionBuilderInterface {
ToRecipients onOutputStream(OutputStream outputStream);
interface ToRecipients {
2018-06-11 01:33:49 +02:00
WithAlgorithms toRecipients(PGPPublicKey... keys);
2018-06-04 19:45:18 +02:00
2018-06-11 01:33:49 +02:00
WithAlgorithms toRecipients(PGPPublicKeyRing... keys);
2018-06-04 19:45:18 +02:00
2018-06-11 01:33:49 +02:00
<O> WithAlgorithms toRecipients(PublicKeyRingSelectionStrategy<O> selectionStrategy,
MultiMap<O, PGPPublicKeyRingCollection> keys);
2018-06-04 19:45:18 +02:00
SignWith doNotEncrypt();
}
interface WithAlgorithms {
2018-06-11 01:33:49 +02:00
WithAlgorithms andToSelf(PGPPublicKey... keys);
2018-06-07 18:12:13 +02:00
2018-06-11 01:33:49 +02:00
WithAlgorithms andToSelf(PGPPublicKeyRing... keys);
<O> WithAlgorithms andToSelf(PublicKeyRingSelectionStrategy<O> selectionStrategy,
MultiMap<O, PGPPublicKeyRingCollection> keys);
2018-06-04 19:45:18 +02:00
SignWith usingAlgorithms(SymmetricKeyAlgorithm symmetricKeyAlgorithm,
HashAlgorithm hashAlgorithm,
CompressionAlgorithm compressionAlgorithm);
2018-06-07 18:12:13 +02:00
SignWith usingSecureAlgorithms();
2018-06-04 19:45:18 +02:00
}
interface SignWith {
2018-06-11 01:33:49 +02:00
<O> Armor signWith(SecretKeyRingProtector decryptor, PGPSecretKey... keys);
2018-06-04 19:45:18 +02:00
2018-06-11 01:33:49 +02:00
<O> Armor signWith(SecretKeyRingProtector decryptor, PGPSecretKeyRing... keyRings);
2018-06-04 19:45:18 +02:00
2018-06-11 01:33:49 +02:00
<O> Armor signWith(SecretKeyRingSelectionStrategy<O> selectionStrategy,
SecretKeyRingProtector decryptor,
MultiMap<O, PGPSecretKeyRingCollection> keys)
2018-06-05 01:30:58 +02:00
throws SecretKeyNotFoundException;
2018-06-04 19:45:18 +02:00
Armor doNotSign();
}
interface Armor {
2018-06-05 01:30:58 +02:00
OutputStream asciiArmor() throws IOException, PGPException;
2018-06-04 19:45:18 +02:00
2018-06-05 01:30:58 +02:00
OutputStream noArmor() throws IOException, PGPException;
2018-06-04 19:45:18 +02:00
}
}