Package org.eclipse.jgit.lib
Interface GpgObjectSigner
- All Known Implementing Classes:
BouncyCastleGpgSigner
public interface GpgObjectSigner
Creates GPG signatures for Git objects.
- Since:
- 5.11
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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
signObject
(ObjectBuilder object, String gpgSigningKey, PersonIdent committer, CredentialsProvider credentialsProvider, GpgConfig config) Signs the specified object.
-
Method Details
-
signObject
void signObject(@NonNull ObjectBuilder object, @Nullable String gpgSigningKey, @NonNull PersonIdent committer, CredentialsProvider credentialsProvider, GpgConfig config) throws CanceledException, UnsupportedSigningFormatException Signs the specified object.Implementors should obtain the payload for signing from the specified object via
ObjectBuilder.build()
and create a properGpgSignature
. The generated signature must be set on the specifiedobject
(seeObjectBuilder.setGpgSignature(GpgSignature)
).Any existing signature on the object must be discarded prior obtaining the payload via
ObjectBuilder.build()
.- Parameters:
object
- the object to sign (must not benull
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 ofuser.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 config- Throws:
CanceledException
- when signing was canceled (eg., user aborted when entering passphrase)UnsupportedSigningFormatException
- if a config is given and the wanted key format is not supported
-
canLocateSigningKey
boolean canLocateSigningKey(@Nullable String gpgSigningKey, @NonNull PersonIdent committer, CredentialsProvider credentialsProvider, GpgConfig config) throws CanceledException, UnsupportedSigningFormatException Indicates if a signing key is available for the specified committer and/or signing key.- Parameters:
gpgSigningKey
- the signing key to locate (passed as is to the GPG signing tool as is; eg., value ofuser.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 config- Returns:
true
if a signing key is available,false
otherwise- Throws:
CanceledException
- when signing was canceled (eg., user aborted when entering passphrase)UnsupportedSigningFormatException
- if a config is given and the wanted key format is not supported
-