From d1001412a15c83313f3bd3f35e6602fab9f38daf Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 29 Aug 2022 12:36:16 +0200 Subject: [PATCH] Add SigningOptions.addDetachedSignature(protector, key) shortcut method --- .../encryption_signing/SigningOptions.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/SigningOptions.java b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/SigningOptions.java index 43db00d1..0a7c47c4 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/SigningOptions.java +++ b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/SigningOptions.java @@ -252,6 +252,23 @@ public final class SigningOptions { return this; } + /** + * Create a detached signature. + * The signature will be of type {@link DocumentSignatureType#BINARY_DOCUMENT}. + * + * @param secretKeyDecryptor decryptor to unlock the secret signing key + * @param signingKey signing key + * @return this + * + * @throws KeyException if something is wrong with the key + * @throws PGPException if the key cannot be validated or unlocked, or if no signature method can be created + */ + public SigningOptions addDetachedSignature(SecretKeyRingProtector secretKeyDecryptor, + PGPSecretKeyRing signingKey) + throws PGPException { + return addDetachedSignature(secretKeyDecryptor, signingKey, DocumentSignatureType.BINARY_DOCUMENT); + } + /** * Create a detached signature. * Detached signatures are not being added into the PGP message itself.