public interface Signer
Creates signatures for Git objects.
- Since:
- 7.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanLocateSigningKey(Repository repository, GpgConfig config, PersonIdent committer, String signingKey, CredentialsProvider credentialsProvider) Indicates if a signing key is available for the specified committer and/or signing key.sign(Repository repository, GpgConfig config, byte[] data, PersonIdent committer, String signingKey, CredentialsProvider credentialsProvider) Signs arbitrary data.default voidsignObject(Repository repository, GpgConfig config, ObjectBuilder object, PersonIdent committer, String signingKey, CredentialsProvider credentialsProvider) Signs the specified object.
-
Method Details
-
signObject
default void signObject(@NonNull Repository repository, @NonNull GpgConfig config, @NonNull ObjectBuilder object, @NonNull PersonIdent committer, String signingKey, CredentialsProvider credentialsProvider) throws CanceledException, IOException, 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 is set on the specifiedobject(seeObjectBuilder.setGpgSignature(GpgSignature)).Any existing signature on the object must be discarded prior obtaining the payload via
ObjectBuilder.build().- Parameters:
repository-Repositorythe object belongs toconfig- GPG settings from the git configobject- the object to sign (must not benulland must be complete to allow proper calculation of payload)committer- the signing identity (to help with key lookup in case signing key is not specified)signingKey- if non-nulloverrides the signing key from the configcredentialsProvider- provider to use when querying for signing key credentials (eg. passphrase)- Throws:
CanceledException- when signing was canceled (eg., user aborted when entering passphrase)IOException- if an I/O error occursUnsupportedSigningFormatException- if a config is given and the wanted key format is not supported
-
sign
GpgSignature sign(@NonNull Repository repository, @NonNull GpgConfig config, byte[] data, @NonNull PersonIdent committer, String signingKey, CredentialsProvider credentialsProvider) throws CanceledException, IOException, UnsupportedSigningFormatException Signs arbitrary data.- Parameters:
repository-Repositorythe signature is created inconfig- GPG settings from the git configdata- the data to signcommitter- the signing identity (to help with key lookup in case signing key is not specified)signingKey- if non-nulloverrides the signing key from the configcredentialsProvider- provider to use when querying for signing key credentials (eg. passphrase)- Returns:
- the signature for
data - Throws:
CanceledException- when signing was canceled (eg., user aborted when entering passphrase)IOException- if an I/O error occursUnsupportedSigningFormatException- if a config is given and the wanted key format is not supported
-
canLocateSigningKey
boolean canLocateSigningKey(@NonNull Repository repository, @NonNull GpgConfig config, @NonNull PersonIdent committer, String signingKey, CredentialsProvider credentialsProvider) throws CanceledException Indicates if a signing key is available for the specified committer and/or signing key.- Parameters:
repository- the currentRepositoryconfig- GPG settings from the git configcommitter- the signing identity (to help with key lookup in case signing key is not specified)signingKey- if non-nulloverrides the signing key from the configcredentialsProvider- provider to use when querying for signing key credentials (eg. passphrase)- Returns:
trueif a signing key is available,falseotherwise- Throws:
CanceledException- when signing was canceled (eg., user aborted when entering passphrase)
-