Top Description Inners Fields Constructors Methods
org.eclipse.jgit.api

public Class VerifySignatureCommand

extends GitCommand<Map<String, VerificationResult>>
Class Inheritance
Imports
java.io.IOException, java.util.Arrays, .Collection, .HashMap, .HashSet, .Map, .Set, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.api.errors.JGitInternalException, .ServiceUnavailableException, .WrongObjectTypeException, org.eclipse.jgit.errors.MissingObjectException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Constants, .GpgConfig, .ObjectId, .Repository, .SignatureVerifier.SignatureVerification, .SignatureVerifiers, org.eclipse.jgit.revwalk.RevObject, .RevWalk

A command to verify GPG signatures on tags or commits.
Since
5.11

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static enum
VerifySignatureCommand.VerifyMode

Describes what kind of objects shall be handled by a VerifySignatureCommand.

Field Summary

Modifier and TypeField and Description
private GpgConfig
private VerifySignatureCommand.VerifyMode
private final Set<String>
Inherited from org.eclipse.jgit.api.GitCommand:
repo

Constructor Summary

AccessConstructor and Description
public
VerifySignatureCommand(Repository
to operate on
repo
)

Creates a new VerifySignatureCommand for the given Repository.

Method Summary

Modifier and TypeMethod and Description
public VerifySignatureCommand

Returns:

this
addName
(String
to add
name
)

Add a name of an object (SHA-1, ref name; anything that can be resolved) to the command to have its signature verified.

public VerifySignatureCommand

Returns:

this
addNames
(String...
to add; duplicates will be ignored
names
)

Add names of objects (SHA-1, ref name; anything that can be resolved) to the command to have their signatures verified.

public VerifySignatureCommand

Returns:

this
addNames
(Collection<String>
to add; duplicates will be ignored
names
)

Add names of objects (SHA-1, ref name; anything that can be resolved) to the command to have their signatures verified.

public Map<String, VerificationResult>

Returns:

a map of the given names to the corresponding VerificationResult, excluding ignored or skipped objects.
call
()

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Resolves all names added to the command to git objects and verifies their signature.

public VerifySignatureCommand

Returns:

this
setGpgConfig
(GpgConfig
to set; if null, the config will be loaded from the git config of the repository
config
)

Sets an external GpgConfig to use.

public VerifySignatureCommand

Returns:

this
setMode
(VerifySignatureCommand.VerifyMode
the VerifyMode to set
mode
)

Sets the mode of operation for this command.

private VerificationResult
Inherited from org.eclipse.jgit.api.GitCommand:
checkCallablegetRepositorysetCallable

Field Detail

configback to summary
private GpgConfig config
modeback to summary
private VerifySignatureCommand.VerifyMode mode
namesToCheckback to summary
private final Set<String> namesToCheck

Constructor Detail

VerifySignatureCommandback to summary
public VerifySignatureCommand(Repository repo)

Creates a new VerifySignatureCommand for the given Repository.

Parameters
repo:Repository

to operate on

Method Detail

addNameback to summary
public VerifySignatureCommand addName(String name)

Add a name of an object (SHA-1, ref name; anything that can be resolved) to the command to have its signature verified.

Parameters
name:String

to add

Returns:VerifySignatureCommand

this

addNamesback to summary
public VerifySignatureCommand addNames(String... names)

Add names of objects (SHA-1, ref name; anything that can be resolved) to the command to have their signatures verified.

Parameters
names:String[]

to add; duplicates will be ignored

Returns:VerifySignatureCommand

this

addNamesback to summary
public VerifySignatureCommand addNames(Collection<String> names)

Add names of objects (SHA-1, ref name; anything that can be resolved) to the command to have their signatures verified.

Parameters
names:Collection<String>

to add; duplicates will be ignored

Returns:VerifySignatureCommand

this

callback to summary
public Map<String, VerificationResult> call() throws ServiceUnavailableException, WrongObjectTypeException

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Resolves all names added to the command to git objects and verifies their signature. Non-existing objects are ignored.

Depending on the setMode(VerifyMode), only tags or commits or any kind of objects are allowed.

Unsigned objects are silently skipped.

Returns:Map<String, VerificationResult>

a map of the given names to the corresponding VerificationResult, excluding ignored or skipped objects.

Annotations
@Override
@NonNull
Exceptions
WrongObjectTypeException:
if a name resolves to an object of a type not allowed by the setMode(VerifyMode) mode
setGpgConfigback to summary
public VerifySignatureCommand setGpgConfig(GpgConfig config)

Sets an external GpgConfig to use.

Parameters
config:GpgConfig

to set; if null, the config will be loaded from the git config of the repository

Returns:VerifySignatureCommand

this

Since
5.11
setModeback to summary
public VerifySignatureCommand setMode(VerifySignatureCommand.VerifyMode mode)

Sets the mode of operation for this command.

Parameters
mode:VerifySignatureCommand.VerifyMode

the VerifyMode to set

Returns:VerifySignatureCommand

this

verifyOneback to summary
private VerificationResult verifyOne(RevObject object) throws WrongObjectTypeException, IOException
org.eclipse.jgit.api back to summary

private Class VerifySignatureCommand.Result

extends Object
implements VerificationResult
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.api.VerificationResult

Field Summary

Modifier and TypeField and Description
private final RevObject
private final Throwable
private final SignatureVerifier.SignatureVerification

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Throwable
getException()

Implements org.eclipse.jgit.api.VerificationResult.getException.

If an error occurred during signature verification, this retrieves the exception.

public RevObject
getObject()

Implements org.eclipse.jgit.api.VerificationResult.getObject.

Retrieves the git object of which the signature was verified.

public SignatureVerifier.SignatureVerification
getVerification()

Implements org.eclipse.jgit.api.VerificationResult.getVerification.

Retrieves the signature verification result.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

objectback to summary
private final RevObject object
throwableback to summary
private final Throwable throwable
verificationback to summary
private final SignatureVerifier.SignatureVerification verification

Constructor Detail

Resultback to summary
public Result(RevObject object, SignatureVerifier.SignatureVerification verification, Throwable throwable)

Method Detail

getExceptionback to summary
public Throwable getException()

Implements org.eclipse.jgit.api.VerificationResult.getException.

Doc from org.eclipse.jgit.api.VerificationResult.getException.

If an error occurred during signature verification, this retrieves the exception.

Returns:Throwable

the exception, or null if none occurred

Annotations
@Override
getObjectback to summary
public RevObject getObject()

Implements org.eclipse.jgit.api.VerificationResult.getObject.

Doc from org.eclipse.jgit.api.VerificationResult.getObject.

Retrieves the git object of which the signature was verified.

Returns:RevObject

the git object

Annotations
@Override
getVerificationback to summary
public SignatureVerifier.SignatureVerification getVerification()

Implements org.eclipse.jgit.api.VerificationResult.getVerification.

Doc from org.eclipse.jgit.api.VerificationResult.getVerification.

Retrieves the signature verification result.

Returns:SignatureVerifier.SignatureVerification

the result, or null if none was computed

Annotations
@Override
org.eclipse.jgit.api back to summary

public final Enum VerifySignatureCommand.VerifyMode

extends Enum<VerifySignatureCommand.VerifyMode>
Class Inheritance

Describes what kind of objects shall be handled by a VerifySignatureCommand.

Field Summary

Modifier and TypeField and Description
public static final VerifySignatureCommand.VerifyMode
ANY

Handle any object type, ignore anything that is not a commit or tag.

public static final VerifySignatureCommand.VerifyMode
COMMITS

Handle only commits; throw a WrongObjectTypeException for anything else.

public static final VerifySignatureCommand.VerifyMode
TAGS

Handle only tags; throw a WrongObjectTypeException for anything else.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static VerifySignatureCommand.VerifyMode
public static VerifySignatureCommand.VerifyMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ANYback to summary
public static final VerifySignatureCommand.VerifyMode ANY

Handle any object type, ignore anything that is not a commit or tag.

COMMITSback to summary
public static final VerifySignatureCommand.VerifyMode COMMITS

Handle only commits; throw a WrongObjectTypeException for anything else.

TAGSback to summary
public static final VerifySignatureCommand.VerifyMode TAGS

Handle only tags; throw a WrongObjectTypeException for anything else.

Constructor Detail

VerifyModeback to summary
private VerifyMode()

Method Detail

valueOfback to summary
public static VerifySignatureCommand.VerifyMode valueOf(String name)
valuesback to summary
public static VerifySignatureCommand.VerifyMode[] values()