Class DigestVerifier

java.lang.Object
net.visma.autopay.http.digest.DigestVerifier

public final class DigestVerifier extends Object
Verifies values of Content-Digest and Repr-Digest headers
See Also:
  • Method Details

    • verifyDigestHeader

      public static void verifyDigestHeader(String digestHeader, byte[] content) throws DigestException
      Verifies provided value of Content-Digest or Repr-Digest header. Throws exception on failure.

      If the header contains multiple digests, those with supported algorithms (defined in DigestAlgorithm) are verified, and verification succeeds if any of the "supported" digests is correct.

      Parameters:
      digestHeader - Header read from HTTP request or response
      content - Binary request or response content. Caller is responsible to use proper encoding, matching Content-Type and Content-Encoding.
      Throws:
      DigestException - Thrown when provided header is syntactically invalid, or any of supported algorithms is included, or digest is incorrect (does not match the computed one).