public class BouncyCastleGpgSigner extends GpgSigner implements GpgObjectSigner
Constructor and Description |
---|
BouncyCastleGpgSigner()
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canLocateSigningKey(String gpgSigningKey,
PersonIdent committer,
CredentialsProvider credentialsProvider)
Indicates if a signing key is available for the specified committer
and/or signing key.
|
boolean |
canLocateSigningKey(String gpgSigningKey,
PersonIdent committer,
CredentialsProvider credentialsProvider,
GpgConfig config)
Indicates if a signing key is available for the specified committer
and/or signing key.
|
void |
sign(CommitBuilder commit,
String gpgSigningKey,
PersonIdent committer,
CredentialsProvider credentialsProvider)
Signs the specified commit.
|
void |
signObject(ObjectBuilder object,
String gpgSigningKey,
PersonIdent committer,
CredentialsProvider credentialsProvider,
GpgConfig config)
Signs the specified object.
|
getDefault, setDefault
public BouncyCastleGpgSigner()
The BounceCastleProvider will be registered if necessary.
public boolean canLocateSigningKey(@Nullable String gpgSigningKey, PersonIdent committer, CredentialsProvider credentialsProvider) throws CanceledException
GpgSigner
canLocateSigningKey
in class GpgSigner
gpgSigningKey
- the signing key to locate (passed as is to the GPG signing
tool as is; eg., value of user.signingkey
)committer
- the signing identity (to help with key lookup in case signing
key is not specified)credentialsProvider
- provider to use when querying for signing key credentials (eg.
passphrase)true
if a signing key is available,
false
otherwiseCanceledException
- when signing was canceled (eg., user aborted when entering
passphrase)public boolean canLocateSigningKey(@Nullable String gpgSigningKey, PersonIdent committer, CredentialsProvider credentialsProvider, GpgConfig config) throws CanceledException, UnsupportedSigningFormatException
GpgObjectSigner
canLocateSigningKey
in interface GpgObjectSigner
gpgSigningKey
- the signing key to locate (passed as is to the GPG signing
tool as is; eg., value of user.signingkey
)committer
- the signing identity (to help with key lookup in case signing
key is not specified)credentialsProvider
- provider to use when querying for signing key credentials (eg.
passphrase)config
- GPG settings from the git configtrue
if a signing key is available,
false
otherwiseCanceledException
- when signing was canceled (eg., user aborted when entering
passphrase)UnsupportedSigningFormatException
- if a config is given and the wanted key format is not
supportedpublic void sign(@NonNull CommitBuilder commit, @Nullable String gpgSigningKey, @NonNull PersonIdent committer, CredentialsProvider credentialsProvider) throws CanceledException
GpgSigner
Implementors should obtain the payload for signing from the specified
commit via CommitBuilder.build()
and create a proper
GpgSignature
. The generated signature must be set on the
specified commit
(see
ObjectBuilder.setGpgSignature(GpgSignature)
).
Any existing signature on the commit must be discarded prior obtaining
the payload via CommitBuilder.build()
.
sign
in class GpgSigner
commit
- the commit to sign (must not be null
and must be
complete to allow proper calculation of payload)gpgSigningKey
- the signing key to locate (passed as is to the GPG signing
tool as is; eg., value of user.signingkey
)committer
- the signing identity (to help with key lookup in case signing
key is not specified)credentialsProvider
- provider to use when querying for signing key credentials (eg.
passphrase)CanceledException
- when signing was canceled (eg., user aborted when entering
passphrase)public void signObject(@NonNull ObjectBuilder object, @Nullable String gpgSigningKey, @NonNull PersonIdent committer, CredentialsProvider credentialsProvider, GpgConfig config) throws CanceledException, UnsupportedSigningFormatException
GpgObjectSigner
Implementors should obtain the payload for signing from the specified
object via ObjectBuilder.build()
and create a proper
GpgSignature
. The generated signature must be set on the
specified object
(see
ObjectBuilder.setGpgSignature(GpgSignature)
).
Any existing signature on the object must be discarded prior obtaining
the payload via ObjectBuilder.build()
.
signObject
in interface GpgObjectSigner
object
- the object to sign (must not be null
and must be
complete to allow proper calculation of payload)gpgSigningKey
- the signing key to locate (passed as is to the GPG signing
tool as is; eg., value of user.signingkey
)committer
- the signing identity (to help with key lookup in case signing
key is not specified)credentialsProvider
- provider to use when querying for signing key credentials (eg.
passphrase)config
- GPG settings from the git configCanceledException
- when signing was canceled (eg., user aborted when entering
passphrase)UnsupportedSigningFormatException
- if a config is given and the wanted key format is not
supportedCopyright © 2021 Eclipse JGit Project. All rights reserved.