Interface Verifier

  • All Known Implementing Classes:
    EcdsaVerifier, RsaVerifier

    public interface Verifier
    A verifier helper that wraps common verification operations for use within this library.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.security.PublicKey getPublicKey()
      Return the public key associated with this verifier.
      boolean verify​(byte[] artifact, byte[] signature)
      Verify an artifact.
      boolean verifyDigest​(byte[] artifactDigest, byte[] signature)
      Verify an artifact using the artifact's sha256 digest.
    • Method Detail

      • getPublicKey

        java.security.PublicKey getPublicKey()
        Return the public key associated with this verifier.
      • verify

        @CheckReturnValue
        boolean verify​(byte[] artifact,
                       byte[] signature)
                throws java.security.NoSuchAlgorithmException,
                       java.security.InvalidKeyException,
                       java.security.SignatureException
        Verify an artifact. Implementations will hash the artifact with sha256 before verifying.
        Parameters:
        artifact - the artifact that was signed
        signature - the signature associated with the artifact
        Returns:
        true if the signature is valid, false otherwise
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.InvalidKeyException
        java.security.SignatureException
      • verifyDigest

        @CheckReturnValue
        boolean verifyDigest​(byte[] artifactDigest,
                             byte[] signature)
                      throws java.security.NoSuchAlgorithmException,
                             java.security.InvalidKeyException,
                             java.security.SignatureException
        Verify an artifact using the artifact's sha256 digest. Implementations do not further hash the input.
        Parameters:
        artifactDigest - the sha256 digest of the artifact that was signed
        signature - the signature associated with the artifact
        Returns:
        true if the signature is valid, false otherwise
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.InvalidKeyException
        java.security.SignatureException