Top Description Inners Methods
org.eclipse.jgit.lib

public Interface SignatureVerifier

Imports
java.io.IOException, java.util.Date, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.api.errors.JGitInternalException

A SignatureVerifier can verify signatures on git commits and tags.
Since
7.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
SignatureVerifier.SignatureVerification

A SignatureVerification returns data about a (positively or negatively) verified signature.

public static enum
SignatureVerifier.TrustLevel

The owner's trust in a public key.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

A SignatureVerifier may cache public keys to speed up verifying signatures on multiple objects.

public String

Returns:

the name
getName
()

Retrieves the name of this verifier.

public SignatureVerifier.SignatureVerification

Returns:

a SignatureVerification describing the outcome
verify
(Repository
the Repository the data comes from.
repository
,
GpgConfig config, byte[]
the signature is for
data
,
byte[]
the ASCII-armored signature
signatureData
)

Verifies a given signature for given data.

Method Detail

clearback to summary
public void clear()

A SignatureVerifier may cache public keys to speed up verifying signatures on multiple objects. This clears this cache, if any.

getNameback to summary
public String getName()

Retrieves the name of this verifier. This should be a short string identifying the engine that verified the signature, like "gpg" if GPG is used, or "bc" for a BouncyCastle implementation.

Returns:String

the name

Annotations
@NonNull
verifyback to summary
public SignatureVerifier.SignatureVerification verify(Repository repository, GpgConfig config, byte[] data, byte[] signatureData) throws IOException

Verifies a given signature for given data.

Parameters
repository:Repository

the Repository the data comes from.

config:GpgConfig

the GpgConfig

data:byte[]

the signature is for

signatureData:byte[]

the ASCII-armored signature

Returns:SignatureVerifier.SignatureVerification

a SignatureVerification describing the outcome

Exceptions
IOException:
if the signature cannot be parsed
JGitInternalException:
if signature verification fails
org.eclipse.jgit.lib back to summary

public final Record SignatureVerifier.SignatureVerification

extends Record
Class Inheritance
Record Components
verifierName:String
the name of the verifier that created this verification result
creationDate:Date
date and time the signature was created
signer:String
the signer as stored in the signature, or null if unknown
keyFingerprint:String
fingerprint of the public key, or null if unknown
keyUser:String
user associated with the key, or null if unknown
verified:boolean
whether the signature verification was successful
expired:boolean
whether the public key used for this signature verification was expired when the signature was created
trustLevel:SignatureVerifier.TrustLevel
the trust level of the public key used to verify the signature
message:String
human-readable message giving additional information about the outcome of the verification, possibly null

A SignatureVerification returns data about a (positively or negatively) verified signature.

Field Summary

Modifier and TypeField and Description
private final Date
creationDate

Record Component accessed by creationDate().

date and time the signature was created
private final boolean
expired

Record Component accessed by expired().

whether the public key used for this signature verification was expired when the signature was created
private final String
keyFingerprint

Record Component accessed by keyFingerprint().

fingerprint of the public key, or null if unknown
private final String
keyUser

Record Component accessed by keyUser().

user associated with the key, or null if unknown
private final String
message

Record Component accessed by message().

human-readable message giving additional information about the outcome of the verification, possibly null
private final String
signer

Record Component accessed by signer().

the signer as stored in the signature, or null if unknown
private final SignatureVerifier.TrustLevel
trustLevel

Record Component accessed by trustLevel().

the trust level of the public key used to verify the signature
private final boolean
verified

Record Component accessed by verified().

whether the signature verification was successful
private final String
verifierName

Record Component accessed by verifierName().

the name of the verifier that created this verification result

Constructor Summary

AccessConstructor and Description
public
SignatureVerification(String verifierName, Date creationDate, String signer, String keyFingerprint, String keyUser, boolean verified, boolean expired, SignatureVerifier.TrustLevel trustLevel, String message)

Method Summary

Modifier and TypeMethod and Description
public Date
creationDate()

Record Component getter of creationDate.

Record Component date and time the signature was created

public final boolean
equals(Object
the reference object with which to compare.
o
)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public boolean
expired()

Record Component getter of expired.

Record Component whether the public key used for this signature verification was expired when the signature was created

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public String
keyFingerprint()

Record Component getter of keyFingerprint.

Record Component fingerprint of the public key, or null if unknown

public String
keyUser()

Record Component getter of keyUser.

Record Component user associated with the key, or null if unknown

public String
message()

Record Component getter of message.

Record Component human-readable message giving additional information about the outcome of the verification, possibly null

public String
signer()

Record Component getter of signer.

Record Component the signer as stored in the signature, or null if unknown

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public SignatureVerifier.TrustLevel
trustLevel()

Record Component getter of trustLevel.

Record Component the trust level of the public key used to verify the signature

public boolean
verified()

Record Component getter of verified.

Record Component whether the signature verification was successful

public String
verifierName()

Record Component getter of verifierName.

Record Component the name of the verifier that created this verification result

Field Detail

creationDateback to summary
private final Date creationDate

Record Component accessed by creationDate().

date and time the signature was created

expiredback to summary
private final boolean expired

Record Component accessed by expired().

whether the public key used for this signature verification was expired when the signature was created

keyFingerprintback to summary
private final String keyFingerprint

Record Component accessed by keyFingerprint().

fingerprint of the public key, or null if unknown

keyUserback to summary
private final String keyUser

Record Component accessed by keyUser().

user associated with the key, or null if unknown

messageback to summary
private final String message

Record Component accessed by message().

human-readable message giving additional information about the outcome of the verification, possibly null

signerback to summary
private final String signer

Record Component accessed by signer().

the signer as stored in the signature, or null if unknown

trustLevelback to summary
private final SignatureVerifier.TrustLevel trustLevel

Record Component accessed by trustLevel().

the trust level of the public key used to verify the signature

Annotations
@NonNull
verifiedback to summary
private final boolean verified

Record Component accessed by verified().

whether the signature verification was successful

verifierNameback to summary
private final String verifierName

Record Component accessed by verifierName().

the name of the verifier that created this verification result

Constructor Detail

SignatureVerificationback to summary
public SignatureVerification(String verifierName, Date creationDate, String signer, String keyFingerprint, String keyUser, boolean verified, boolean expired, SignatureVerifier.TrustLevel trustLevel, String message)

Method Detail

creationDateback to summary
public Date creationDate()

Record Component getter of creationDate.

Record Component
date and time the signature was created
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this record is equal to the argument; false otherwise.

expiredback to summary
public boolean expired()

Record Component getter of expired.

Record Component
whether the public key used for this signature verification was expired when the signature was created
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

Returns:int

a hash code value for this record.

keyFingerprintback to summary
public String keyFingerprint()

Record Component getter of keyFingerprint.

Record Component
fingerprint of the public key, or null if unknown
keyUserback to summary
public String keyUser()

Record Component getter of keyUser.

Record Component
user associated with the key, or null if unknown
messageback to summary
public String message()

Record Component getter of message.

Record Component
human-readable message giving additional information about the outcome of the verification, possibly null
signerback to summary
public String signer()

Record Component getter of signer.

Record Component
the signer as stored in the signature, or null if unknown
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

Returns:String

a string representation of the object.

trustLevelback to summary
public SignatureVerifier.TrustLevel trustLevel()

Record Component getter of trustLevel.

Record Component
the trust level of the public key used to verify the signature
Annotations
@NonNull
verifiedback to summary
public boolean verified()

Record Component getter of verified.

Record Component
whether the signature verification was successful
verifierNameback to summary
public String verifierName()

Record Component getter of verifierName.

Record Component
the name of the verifier that created this verification result
org.eclipse.jgit.lib back to summary

public final Enum SignatureVerifier.TrustLevel

extends Enum<SignatureVerifier.TrustLevel>
Class Inheritance

The owner's trust in a public key.

Field Summary

Modifier and TypeField and Description
public static final SignatureVerifier.TrustLevel
public static final SignatureVerifier.TrustLevel
public static final SignatureVerifier.TrustLevel
public static final SignatureVerifier.TrustLevel
public static final SignatureVerifier.TrustLevel

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

FULLback to summary
public static final SignatureVerifier.TrustLevel FULL
MARGINALback to summary
public static final SignatureVerifier.TrustLevel MARGINAL
NEVERback to summary
public static final SignatureVerifier.TrustLevel NEVER
ULTIMATEback to summary
public static final SignatureVerifier.TrustLevel ULTIMATE
UNKNOWNback to summary
public static final SignatureVerifier.TrustLevel UNKNOWN

Constructor Detail

TrustLevelback to summary
private TrustLevel()

Method Detail

valueOfback to summary
public static SignatureVerifier.TrustLevel valueOf(String name)
valuesback to summary
public static SignatureVerifier.TrustLevel[] values()