public class OpenPGPDetachedSignatureGenerator extends AbstractOpenPGPDocumentSignatureGenerator<OpenPGPDetachedSignatureGenerator>
To use this class, instantiate it, optionally providing a concrete OpenPGPImplementation
and
OpenPGPPolicy
for algorithm policing.
Then, add the desired OpenPGPKey
you want to use for signing the data via one or more
calls to AbstractOpenPGPDocumentSignatureGenerator.addSigningKey(OpenPGPKey, KeyPassphraseProvider)
.
You have fine-grained control over the signature by using the method
AbstractOpenPGPDocumentSignatureGenerator.addSigningKey(OpenPGPKey.OpenPGPSecretKey, char[], SignatureParameters.Callback)
.
Lastly, retrieve a list of detached signatures
by calling
sign(InputStream)
, passing in an InputStream
containing the data you want to sign.
defaultKeyPassphraseProvider, implementation, policy, signatureCallbacks, signatureGenerators, signingKeyPassphraseProviders, signingKeys, signingKeySelector
Constructor and Description |
---|
OpenPGPDetachedSignatureGenerator()
Instantiate a signature generator using the default
OpenPGPImplementation and its OpenPGPPolicy . |
OpenPGPDetachedSignatureGenerator(OpenPGPImplementation implementation)
Instantiate a signature generator using the passed in
OpenPGPImplementation and its OpenPGPPolicy . |
OpenPGPDetachedSignatureGenerator(OpenPGPImplementation implementation,
OpenPGPPolicy policy)
Instantiate a signature generator using a custom
OpenPGPImplementation and custom OpenPGPPolicy . |
Modifier and Type | Method and Description |
---|---|
java.util.List<OpenPGPSignature.OpenPGPDocumentSignature> |
sign(java.io.InputStream inputStream)
Pass in an
InputStream containing the data that shall be signed and return a list of detached
signatures. |
addKeyPassphrase, addSigningKey, addSigningKey, addSigningKey, addSigningKey, addSigningKey, addSigningKey, addSignToGenerator, initSignatureGenerator, setMissingKeyPassphraseCallback, setSigningKeySelector
public OpenPGPDetachedSignatureGenerator()
OpenPGPImplementation
and its OpenPGPPolicy
.public OpenPGPDetachedSignatureGenerator(OpenPGPImplementation implementation)
OpenPGPImplementation
and its OpenPGPPolicy
.implementation
- custom OpenPGP implementationpublic OpenPGPDetachedSignatureGenerator(OpenPGPImplementation implementation, OpenPGPPolicy policy)
OpenPGPImplementation
and custom OpenPGPPolicy
.implementation
- custom OpenPGP implementationpolicy
- custom OpenPGP policypublic java.util.List<OpenPGPSignature.OpenPGPDocumentSignature> sign(java.io.InputStream inputStream) throws java.io.IOException, PGPException
InputStream
containing the data that shall be signed and return a list of detached
signatures.inputStream
- data to be signedjava.io.IOException
- if something goes wrong processing the dataPGPException
- if signing fails