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 java.lang.Object implements GpgSignatureVerifier
AGpgSignatureVerifierto verify GPG signatures using BouncyCastle.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBouncyCastleGpgSignatureVerifier.VerificationResult-
Nested classes/interfaces inherited from interface org.eclipse.jgit.lib.GpgSignatureVerifier
GpgSignatureVerifier.SignatureVerification, GpgSignatureVerifier.TrustLevel
-
-
Field Summary
Fields Modifier and Type Field Description private LRUMap<java.lang.String,java.lang.Object>byFingerprintprivate LRUMap<java.lang.String,java.lang.Object>bySignerprivate static java.lang.ObjectNO_KEY
-
Constructor Summary
Constructors Constructor Description BouncyCastleGpgSignatureVerifier()Creates a new instance and registers the BouncyCastle security provider if needed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()AGpgSignatureVerifiermay cache public keys to speed up verifying signatures on multiple objects.java.lang.StringgetName()Retrieves the name of this verifier.private GpgSignatureVerifier.TrustLevelparseGpgTrustPacket(byte[] packet)(package private) static org.bouncycastle.openpgp.PGPSignatureparseSignature(java.io.InputStream in)private static voidregisterBouncyCastleProviderIfNecessary()GpgSignatureVerifier.SignatureVerificationverify(byte[] data, byte[] signatureData)Verifies a given signature for given data.GpgSignatureVerifier.SignatureVerificationverifySignature(RevObject object, GpgConfig config)Verifies the signature on a signed commit or tag.
-
-
-
Method Detail
-
registerBouncyCastleProviderIfNecessary
private static void registerBouncyCastleProviderIfNecessary()
-
getName
public java.lang.String getName()
Description copied from interface:GpgSignatureVerifierRetrieves 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:
getNamein interfaceGpgSignatureVerifier- Returns:
- the name
-
verifySignature
@Nullable public GpgSignatureVerifier.SignatureVerification verifySignature(@NonNull RevObject object, @NonNull GpgConfig config) throws java.io.IOException
Description copied from interface:GpgSignatureVerifierVerifies the signature on a signed commit or tag.- Specified by:
verifySignaturein interfaceGpgSignatureVerifier- Parameters:
object- to verifyconfig- theGpgConfigto use- Returns:
- a
GpgSignatureVerifier.SignatureVerificationdescribing the outcome of the verification, ornullif the object was not signed - Throws:
java.io.IOException- if an error occurs getting a public key
-
parseSignature
static org.bouncycastle.openpgp.PGPSignature parseSignature(java.io.InputStream in) throws java.io.IOException, org.bouncycastle.openpgp.PGPException- Throws:
java.io.IOExceptionorg.bouncycastle.openpgp.PGPException
-
verify
public GpgSignatureVerifier.SignatureVerification verify(byte[] data, byte[] signatureData) throws java.io.IOException
Description copied from interface:GpgSignatureVerifierVerifies a given signature for given data.- Specified by:
verifyin interfaceGpgSignatureVerifier- Parameters:
data- the signature is forsignatureData- the ASCII-armored signature- Returns:
- a
GpgSignatureVerifier.SignatureVerificationdescribing the outcome - Throws:
java.io.IOException- if the signature cannot be parsed
-
parseGpgTrustPacket
private GpgSignatureVerifier.TrustLevel parseGpgTrustPacket(byte[] packet)
-
clear
public void clear()
Description copied from interface:GpgSignatureVerifierAGpgSignatureVerifiermay cache public keys to speed up verifying signatures on multiple objects. This clears this cache, if any.- Specified by:
clearin interfaceGpgSignatureVerifier
-
-