public class AbstractOpenPGPDocumentSignatureGenerator<T extends AbstractOpenPGPDocumentSignatureGenerator<T>>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected KeyPassphraseProvider.DefaultKeyPassphraseProvider |
defaultKeyPassphraseProvider |
protected OpenPGPImplementation |
implementation |
protected OpenPGPPolicy |
policy |
protected java.util.List<SignatureParameters.Callback> |
signatureCallbacks |
protected java.util.List<PGPSignatureGenerator> |
signatureGenerators |
protected java.util.List<KeyPassphraseProvider> |
signingKeyPassphraseProviders |
protected java.util.List<OpenPGPKey.OpenPGPSecretKey> |
signingKeys |
protected SubkeySelector |
signingKeySelector |
Constructor and Description |
---|
AbstractOpenPGPDocumentSignatureGenerator(OpenPGPImplementation implementation,
OpenPGPPolicy policy) |
Modifier and Type | Method and Description |
---|---|
T |
addKeyPassphrase(char[] passphrase)
Add a passphrase for unlocking signing keys to the set of available passphrases.
|
T |
addSigningKey(OpenPGPKey.OpenPGPSecretKey signingKey,
char[] passphrase,
SignatureParameters.Callback signatureCallback)
Add the given signing (sub-)key for message signing, using the optional passphrase to unlock the
key in case its locked, and using the given
SignatureParameters.Callback to allow
modification of the signature contents. |
T |
addSigningKey(OpenPGPKey.OpenPGPSecretKey signingKey,
KeyPassphraseProvider passphraseProvider,
SignatureParameters.Callback signatureCallback)
Add the given signing (sub-)key for message signing, using the passphrase provider to unlock the
key in case its locked, and using the given
SignatureParameters.Callback to allow
modification of the signature contents. |
T |
addSigningKey(OpenPGPKey key)
Add an
OpenPGPKey for message signing. |
T |
addSigningKey(OpenPGPKey key,
KeyPassphraseProvider passphraseProvider)
Add an
OpenPGPKey for message signing, using the provided KeyPassphraseProvider to
unlock protected subkeys. |
T |
addSigningKey(OpenPGPKey key,
KeyPassphraseProvider passphraseProvider,
SignatureParameters.Callback signatureCallback)
Add an
OpenPGPKey for message signing, using the given KeyPassphraseProvider
for unlocking protected subkeys and using the SignatureParameters.Callback to allow
modification of the signature contents. |
T |
addSigningKey(OpenPGPKey key,
SignatureParameters.Callback signatureCallback)
Add an
OpenPGPKey for message signing, using the SignatureParameters.Callback to
allow modification of the signature contents. |
protected void |
addSignToGenerator() |
protected PGPSignatureGenerator |
initSignatureGenerator(OpenPGPKey.OpenPGPSecretKey signingKey,
KeyPassphraseProvider passphraseProvider,
SignatureParameters.Callback signatureCallback) |
T |
setMissingKeyPassphraseCallback(KeyPassphraseProvider callback)
Set a callback that will be fired, if a passphrase for a protected signing key is missing.
|
T |
setSigningKeySelector(SubkeySelector signingKeySelector)
Replace the default signing key selector with a custom implementation.
|
protected final OpenPGPImplementation implementation
protected final OpenPGPPolicy policy
protected final java.util.List<PGPSignatureGenerator> signatureGenerators
protected final java.util.List<OpenPGPKey.OpenPGPSecretKey> signingKeys
protected final java.util.List<SignatureParameters.Callback> signatureCallbacks
protected final java.util.List<KeyPassphraseProvider> signingKeyPassphraseProviders
protected final KeyPassphraseProvider.DefaultKeyPassphraseProvider defaultKeyPassphraseProvider
protected SubkeySelector signingKeySelector
public AbstractOpenPGPDocumentSignatureGenerator(OpenPGPImplementation implementation, OpenPGPPolicy policy)
public T setSigningKeySelector(SubkeySelector signingKeySelector)
signingKeySelector
- selector for signing (sub-)keyspublic T addKeyPassphrase(char[] passphrase)
passphrase
- passphrasepublic T addSigningKey(OpenPGPKey key) throws InvalidSigningKeyException
OpenPGPKey
for message signing.
The signingKeySelector
is responsible for selecting one or more subkeys of the key to sign with.
If no (sub-)key in the signing key is capable of creating signatures, or if the key is expired or revoked,
this method will throw an InvalidSigningKeyException
.key
- OpenPGP keyInvalidSigningKeyException
- if the key is not capable of signingpublic T addSigningKey(OpenPGPKey key, KeyPassphraseProvider passphraseProvider) throws InvalidSigningKeyException
OpenPGPKey
for message signing, using the provided KeyPassphraseProvider
to
unlock protected subkeys.
The signingKeySelector
is responsible for selecting one or more subkeys of the key to sign with.
If no (sub-)key in the signing key is capable of creating signatures, or if the key is expired or revoked,
this method will throw an InvalidSigningKeyException
.key
- OpenPGP keypassphraseProvider
- provides the passphrase to unlock the signing keyInvalidSigningKeyException
- if the OpenPGP key does not contain a usable signing subkeypublic T addSigningKey(OpenPGPKey key, SignatureParameters.Callback signatureCallback) throws InvalidSigningKeyException
OpenPGPKey
for message signing, using the SignatureParameters.Callback
to
allow modification of the signature contents.
The signingKeySelector
is responsible for selecting one or more subkeys of the key to sign with.
If no (sub-)key in the signing key is capable of creating signatures, or if the key is expired or revoked,
this method will throw an InvalidSigningKeyException
.key
- OpenPGP keysignatureCallback
- optional callback to modify the signature contents withInvalidSigningKeyException
- if the OpenPGP key does not contain a usable signing subkeypublic T addSigningKey(OpenPGPKey key, KeyPassphraseProvider passphraseProvider, SignatureParameters.Callback signatureCallback) throws InvalidSigningKeyException
OpenPGPKey
for message signing, using the given KeyPassphraseProvider
for unlocking protected subkeys and using the SignatureParameters.Callback
to allow
modification of the signature contents.
The signingKeySelector
is responsible for selecting one or more subkeys of the key to sign with.
If no (sub-)key in the signing key is capable of creating signatures, or if the key is expired or revoked,
this method will throw an InvalidSigningKeyException
.key
- OpenPGP keypassphraseProvider
- key passphrase providersignatureCallback
- optional callback to modify the signature contents withInvalidSigningKeyException
- if the OpenPGP key does not contain a usable signing subkeypublic T addSigningKey(OpenPGPKey.OpenPGPSecretKey signingKey, char[] passphrase, SignatureParameters.Callback signatureCallback) throws InvalidSigningKeyException
SignatureParameters.Callback
to allow
modification of the signature contents.signingKey
- signing (sub-)keypassphrase
- optional subkey passphrasesignatureCallback
- optional callback to modify the signature contentsInvalidSigningKeyException
- if the subkey is not signing-capablepublic T addSigningKey(OpenPGPKey.OpenPGPSecretKey signingKey, KeyPassphraseProvider passphraseProvider, SignatureParameters.Callback signatureCallback) throws InvalidSigningKeyException
SignatureParameters.Callback
to allow
modification of the signature contents.signingKey
- signing (sub-)keypassphraseProvider
- passphrase provider for unlocking the subkeysignatureCallback
- optional callback to modify the signature contentsInvalidSigningKeyException
- if the subkey is not signing-capableprotected PGPSignatureGenerator initSignatureGenerator(OpenPGPKey.OpenPGPSecretKey signingKey, KeyPassphraseProvider passphraseProvider, SignatureParameters.Callback signatureCallback) throws PGPException
PGPException
public T setMissingKeyPassphraseCallback(KeyPassphraseProvider callback)
callback
- passphrase providerprotected void addSignToGenerator() throws PGPException
PGPException