mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 22:32:07 +01:00
Add shortcut SigningOptions.addSignature() method
This commit is contained in:
parent
d0b070f0f3
commit
0bce68d6ee
2 changed files with 16 additions and 1 deletions
|
@ -98,6 +98,21 @@ public final class SigningOptions {
|
|||
return new SigningOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign the message using an inline signature made by the provided signing key.
|
||||
*
|
||||
* @param signingKeyProtector protector to unlock the signing key
|
||||
* @param signingKey key ring containing the signing key
|
||||
* @return this
|
||||
*
|
||||
* @throws PGPException if the key cannot be unlocked or a signing method cannot be created
|
||||
*/
|
||||
public SigningOptions addSignature(SecretKeyRingProtector signingKeyProtector,
|
||||
PGPSecretKeyRing signingKey)
|
||||
throws PGPException {
|
||||
return addInlineSignature(signingKeyProtector, signingKey, DocumentSignatureType.BINARY_DOCUMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add inline signatures with all secret key rings in the provided secret key ring collection.
|
||||
*
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Sign {
|
|||
EncryptionStream signingStream = PGPainless.encryptAndOrSign()
|
||||
.onOutputStream(signedOut)
|
||||
.withOptions(ProducerOptions.sign(SigningOptions.get()
|
||||
.addInlineSignature(protector, secretKey, DocumentSignatureType.CANONICAL_TEXT_DOCUMENT))
|
||||
.addSignature(protector, secretKey))
|
||||
);
|
||||
|
||||
Streams.pipeAll(messageIn, signingStream);
|
||||
|
|
Loading…
Reference in a new issue