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

74 lines
2.3 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-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;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
public interface EncryptionBuilderInterface {
ToRecipients onOutputStream(OutputStream outputStream);
interface ToRecipients {
WithAlgorithms toRecipient(PGPPublicKey key);
2018-06-07 18:12:13 +02:00
WithAlgorithms toRecipients(Set<PGPPublicKeyRing> keys);
2018-06-04 19:45:18 +02:00
2018-06-07 18:12:13 +02:00
WithAlgorithms toRecipients(Set<Long> keyIds, Set<PGPPublicKeyRingCollection> keys)
2018-06-04 19:45:18 +02:00
throws PublicKeyNotFoundException;
SignWith doNotEncrypt();
}
interface WithAlgorithms {
2018-06-07 18:12:13 +02:00
WithAlgorithms andToSelf(PGPPublicKey key);
WithAlgorithms andToSelf(Set<PGPPublicKeyRing> 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-07 18:12:13 +02:00
Armor signWith(PGPSecretKeyRing key, SecretKeyRingProtector decryptor);
2018-06-04 19:45:18 +02:00
2018-06-07 18:12:13 +02:00
Armor signWith(Set<PGPSecretKeyRing> keyRings, SecretKeyRingProtector decryptor)
2018-06-05 01:30:58 +02:00
throws SecretKeyNotFoundException;
2018-06-04 19:45:18 +02:00
2018-06-07 18:12:13 +02:00
Armor signWith(Set<Long> keyIds, Set<PGPSecretKeyRingCollection> keys, SecretKeyRingProtector decryptor)
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
}
}