Package net.visma.autopay.http.digest
Class DigestCalculator
java.lang.Object
net.visma.autopay.http.digest.DigestCalculator
Calculates values for Content-Digest and Repr-Digest headers
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
calculateDigestHeader
(byte[] content, String wantDigestHeader) Calculates value of a digest, based on wanted digest taken from Want-Content-Digest or Want-Repr-Digest header.static String
calculateDigestHeader
(byte[] content, DigestAlgorithm algorithm) Calculates value of a digest, which can be directly copied to HTTP header.
-
Method Details
-
calculateDigestHeader
Calculates value of a digest, which can be directly copied to HTTP header.To include multiple digests (with different algorithms) call this method multiple times and concatenate the results using ", " as a separator.
- Parameters:
content
- Binary request or response content. Caller is responsible to use proper encoding, matching Content-Type and Content-Encoding.algorithm
- Hash algorithm- Returns:
- Digest filed to be directly copied to the header
- See Also:
-
calculateDigestHeader
public static String calculateDigestHeader(byte[] content, String wantDigestHeader) throws DigestException Calculates value of a digest, based on wanted digest taken from Want-Content-Digest or Want-Repr-Digest header.Only algorithms defined in
DigestAlgorithm
are supported.- Parameters:
content
- Binary request or response content. Caller is responsible to use proper encoding, matching Content-Type and Content-Encoding.wantDigestHeader
- Value of Want-Content-Digest or Want-Repr-Digest header- Returns:
- Digest filed to be directly copied to the header
- Throws:
DigestException
- Invalid Want-... header or unsupported wanted algorithm(s).- See Also:
-