Package org.eclipse.jgit.gpg.bc.internal
Class BouncyCastleGpgSignatureVerifier
java.lang.Object
org.eclipse.jgit.gpg.bc.internal.BouncyCastleGpgSignatureVerifier
- All Implemented Interfaces:
GpgSignatureVerifier
A
GpgSignatureVerifier
to verify GPG signatures using BouncyCastle.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Nested classes/interfaces inherited from interface org.eclipse.jgit.lib.GpgSignatureVerifier
GpgSignatureVerifier.SignatureVerification, GpgSignatureVerifier.TrustLevel
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance and registers the BouncyCastle security provider if needed. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
AGpgSignatureVerifier
may cache public keys to speed up verifying signatures on multiple objects.getName()
Retrieves the name of this verifier.private GpgSignatureVerifier.TrustLevel
parseGpgTrustPacket
(byte[] packet) (package private) static org.bouncycastle.openpgp.PGPSignature
private static void
verify
(byte[] data, byte[] signatureData) Verifies a given signature for given data.verifySignature
(RevObject object, GpgConfig config) Verifies the signature on a signed commit or tag.
-
Field Details
-
NO_KEY
-
byFingerprint
-
bySigner
-
-
Constructor Details
-
BouncyCastleGpgSignatureVerifier
public BouncyCastleGpgSignatureVerifier()Creates a new instance and registers the BouncyCastle security provider if needed.
-
-
Method Details
-
registerBouncyCastleProviderIfNecessary
private static void registerBouncyCastleProviderIfNecessary() -
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
-
parseSignature
static org.bouncycastle.openpgp.PGPSignature parseSignature(InputStream in) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOException
org.bouncycastle.openpgp.PGPException
-
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
-
parseGpgTrustPacket
-
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
-