Top Description Methods
org.eclipse.jgit.lib

public Interface Signer

Imports
java.io.IOException, .UnsupportedEncodingException, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.api.errors.CanceledException, .JGitInternalException, .UnsupportedSigningFormatException, org.eclipse.jgit.transport.CredentialsProvider

Creates signatures for Git objects.
Since
7.0

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if a signing key is available, false otherwise
canLocateSigningKey
(Repository
the current Repository
repository
,
GpgConfig
GPG settings from the git config
config
,
PersonIdent
the signing identity (to help with key lookup in case signing key is not specified)
committer
,
String
if non-null overrides the signing key from the config
signingKey
,
CredentialsProvider
provider to use when querying for signing key credentials (eg. passphrase)
credentialsProvider
)

Indicates if a signing key is available for the specified committer and/or signing key.

public GpgSignature

Returns:

the signature for data
sign
(Repository
Repository the signature is created in
repository
,
GpgConfig
GPG settings from the git config
config
,
byte[]
the data to sign
data
,
PersonIdent
the signing identity (to help with key lookup in case signing key is not specified)
committer
,
String
if non-null overrides the signing key from the config
signingKey
,
CredentialsProvider
provider to use when querying for signing key credentials (eg. passphrase)
credentialsProvider
)

Signs arbitrary data.

public default void
signObject(Repository
Repository the object belongs to
repository
,
GpgConfig
GPG settings from the git config
config
,
ObjectBuilder
the object to sign (must not be null and must be complete to allow proper calculation of payload)
object
,
PersonIdent
the signing identity (to help with key lookup in case signing key is not specified)
committer
,
String
if non-null overrides the signing key from the config
signingKey
,
CredentialsProvider
provider to use when querying for signing key credentials (eg. passphrase)
credentialsProvider
)

Signs the specified object.

Method Detail

canLocateSigningKeyback to summary
public boolean canLocateSigningKey(Repository repository, GpgConfig config, 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:Repository

the current Repository

config:GpgConfig

GPG settings from the git config

committer:PersonIdent

the signing identity (to help with key lookup in case signing key is not specified)

signingKey:String

if non-null overrides the signing key from the config

credentialsProvider:CredentialsProvider

provider to use when querying for signing key credentials (eg. passphrase)

Returns:boolean

true if a signing key is available, false otherwise

Exceptions
CanceledException:
when signing was canceled (eg., user aborted when entering passphrase)
signback to summary
public GpgSignature sign(Repository repository, GpgConfig config, byte[] data, PersonIdent committer, String signingKey, CredentialsProvider credentialsProvider) throws CanceledException, IOException, UnsupportedSigningFormatException

Signs arbitrary data.

Parameters
repository:Repository

Repository the signature is created in

config:GpgConfig

GPG settings from the git config

data:byte[]

the data to sign

committer:PersonIdent

the signing identity (to help with key lookup in case signing key is not specified)

signingKey:String

if non-null overrides the signing key from the config

credentialsProvider:CredentialsProvider

provider to use when querying for signing key credentials (eg. passphrase)

Returns:GpgSignature

the signature for data

Exceptions
CanceledException:
when signing was canceled (eg., user aborted when entering passphrase)
IOException:
if an I/O error occurs
UnsupportedSigningFormatException:
if a config is given and the wanted key format is not supported
signObjectback to summary
public default void signObject(Repository repository, GpgConfig config, ObjectBuilder object, 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 proper GpgSignature. The generated signature is 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().

Parameters
repository:Repository

Repository the object belongs to

config:GpgConfig

GPG settings from the git config

object:ObjectBuilder

the object to sign (must not be null and must be complete to allow proper calculation of payload)

committer:PersonIdent

the signing identity (to help with key lookup in case signing key is not specified)

signingKey:String

if non-null overrides the signing key from the config

credentialsProvider:CredentialsProvider

provider to use when querying for signing key credentials (eg. passphrase)

Exceptions
CanceledException:
when signing was canceled (eg., user aborted when entering passphrase)
IOException:
if an I/O error occurs
UnsupportedSigningFormatException:
if a config is given and the wanted key format is not supported