Class BouncyCastleVerifier
java.lang.Object
co.elastic.apm.attach.bouncycastle.BouncyCastleVerifier
- All Implemented Interfaces:
PgpSignatureVerifier
DO NOT ACCESS DIRECTLY FROM PRODUCTION CODE!
This class should only be accessed through
PgpSignatureVerifierLoader because it
depends on Bouncy Castle that must be loaded in the original jars through a dedicated class loader.
It is excluded from the CLI jar during build.
The only reason it is public is so we can instantiate through reflection without invoking the deprecated
setAccessible(true).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanverifyPgpSignature(InputStream toVerify, InputStream expectedPgpSignature, InputStream rawPublicKey, String keyID) A Bouncy Castle implementation for PGP signature verification.
-
Constructor Details
-
BouncyCastleVerifier
public BouncyCastleVerifier()
-
-
Method Details
-
verifyPgpSignature
public boolean verifyPgpSignature(InputStream toVerify, InputStream expectedPgpSignature, InputStream rawPublicKey, String keyID) throws Exception A Bouncy Castle implementation for PGP signature verification. Verifying the given file's PGP signature based on the given public key ID and the expected signature.- Specified by:
verifyPgpSignaturein interfacePgpSignatureVerifier- Parameters:
toVerify- the file to verifyexpectedPgpSignature- the expected PGP signature, based on the public key corresponding the given key IDrawPublicKey- PGP public keykeyID- PGP public key ID corresponding thepublicKeyISargument- Returns:
trueif the provided file was verified successfully,falseotherwise- Throws:
Exception- indication failure to read from any of the givenInputStreams or failure during the execution of PGP verification
-