diff --git a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionOptions.java b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionOptions.java index 9075aaef..ab91b99e 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionOptions.java +++ b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionOptions.java @@ -26,6 +26,7 @@ import java.util.Set; import org.bouncycastle.openpgp.PGPPublicKey; import org.bouncycastle.openpgp.PGPPublicKeyRing; +import org.bouncycastle.openpgp.PGPPublicKeyRingCollection; import org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator; import org.bouncycastle.openpgp.operator.PGPKeyEncryptionMethodGenerator; import org.pgpainless.algorithm.SymmetricKeyAlgorithm; @@ -104,6 +105,19 @@ public class EncryptionOptions { return new EncryptionOptions(EncryptionStream.Purpose.STORAGE); } + /** + * Add all key rings in the provided key ring collection as recipients. + * + * @param keys keys + * @return this + */ + public EncryptionOptions addRecipients(PGPPublicKeyRingCollection keys) { + for (PGPPublicKeyRing key : keys) { + addRecipient(key); + } + return this; + } + /** * Add a recipient by providing a key and recipient user-id. * The user-id is used to determine the recipients preferences (algorithms etc.).