java.lang.Object
org.eclipse.jgit.lib.SignatureVerifiers
Manages the available signers.
- Since:
- 7.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic SignatureVerifierget(GpgConfig.GpgFormat format) Retrieves aSignerthat can produce signatures of the given typeformat.static GpgConfig.GpgFormatgetFormat(byte[] signature) Determines the type of a given signature.static voidset(GpgConfig.GpgFormat format, SignatureVerifier verifier) Sets a specific signature verifier to use for a specific signature type.verify(Repository repository, GpgConfig config, byte[] data, byte[] signature) Verifies a given signature for some give data.verify(Repository repository, GpgConfig config, RevObject object) Verifies the signature on a signed commit or tag.
-
Method Details
-
get
Retrieves aSignerthat can produce signatures of the given typeformat.- Parameters:
format-GpgConfig.GpgFormatthe signer must support- Returns:
- a
Signer, ornullif none is available
-
set
Sets a specific signature verifier to use for a specific signature type.- Parameters:
format- signature type to set theverifierforverifier- theSignatureVerifierto use for signatures of typeformat; ifnull, a default implementation, if available, may be used.
-
verify
@Nullable public static SignatureVerifier.SignatureVerification verify(@NonNull Repository repository, @NonNull GpgConfig config, @NonNull RevObject object) throws IOException Verifies the signature on a signed commit or tag.- Parameters:
repository- theRepositorythe object is fromconfig- theGpgConfigto useobject- to verify- Returns:
- a
SignatureVerifier.SignatureVerificationdescribing the outcome of the verification, ornullif the object does not have a signature of a known type - Throws:
IOException- if an error occurs getting a public keyJGitInternalException- if signature verification fails
-
verify
@Nullable public static SignatureVerifier.SignatureVerification verify(@NonNull Repository repository, @NonNull GpgConfig config, byte[] data, byte[] signature) throws IOException Verifies a given signature for some give data.- Parameters:
repository- theRepositorythe object is fromconfig- theGpgConfigto usedata- to verify the signature ofsignature- the given signature of thedata- Returns:
- a
SignatureVerifier.SignatureVerificationdescribing the outcome of the verification, ornullif the signature type is unknown - Throws:
IOException- if an error occurs getting a public keyJGitInternalException- if signature verification fails
-
getFormat
Determines the type of a given signature.- Parameters:
signature- to get the type of- Returns:
- the signature type, or
nullif unknown
-