Package org.eclipse.jgit.gpg.bc.internal
Class BouncyCastleGpgSignatureVerifier
- java.lang.Object
-
- org.eclipse.jgit.gpg.bc.internal.BouncyCastleGpgSignatureVerifier
-
- All Implemented Interfaces:
GpgSignatureVerifier
public class BouncyCastleGpgSignatureVerifier extends Object implements GpgSignatureVerifier
AGpgSignatureVerifier
to verify GPG signatures using BouncyCastle.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jgit.lib.GpgSignatureVerifier
GpgSignatureVerifier.SignatureVerification, GpgSignatureVerifier.TrustLevel
-
-
Constructor Summary
Constructors Constructor Description BouncyCastleGpgSignatureVerifier()
Creates a new instance and registers the BouncyCastle security provider if needed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
AGpgSignatureVerifier
may cache public keys to speed up verifying signatures on multiple objects.String
getName()
Retrieves the name of this verifier.GpgSignatureVerifier.SignatureVerification
verify(byte[] data, byte[] signatureData)
Verifies a given signature for given data.GpgSignatureVerifier.SignatureVerification
verifySignature(RevObject object, GpgConfig config)
Verifies the signature on a signed commit or tag.
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:GpgSignatureVerifier
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.- Specified by:
getName
in interfaceGpgSignatureVerifier
- Returns:
- the name
-
verifySignature
@Nullable public GpgSignatureVerifier.SignatureVerification verifySignature(@NonNull RevObject object, @NonNull GpgConfig config) throws IOException
Description copied from interface:GpgSignatureVerifier
Verifies the signature on a signed commit or tag.- Specified by:
verifySignature
in interfaceGpgSignatureVerifier
- Parameters:
object
- to verifyconfig
- theGpgConfig
to use- Returns:
- a
GpgSignatureVerifier.SignatureVerification
describing the outcome of the verification, ornull
if the object was not signed - Throws:
IOException
- if an error occurs getting a public key
-
verify
public GpgSignatureVerifier.SignatureVerification verify(byte[] data, byte[] signatureData) throws IOException
Description copied from interface:GpgSignatureVerifier
Verifies a given signature for given data.- Specified by:
verify
in interfaceGpgSignatureVerifier
- Parameters:
data
- the signature is forsignatureData
- the ASCII-armored signature- Returns:
- a
GpgSignatureVerifier.SignatureVerification
describing the outcome - Throws:
IOException
- if the signature cannot be parsed
-
clear
public void clear()
Description copied from interface:GpgSignatureVerifier
AGpgSignatureVerifier
may cache public keys to speed up verifying signatures on multiple objects. This clears this cache, if any.- Specified by:
clear
in interfaceGpgSignatureVerifier
-
-