Interface Checksummer

  • All Known Implementing Classes:
    FlexibleChecksummer, PrecomputedSha256Checksummer

    public interface Checksummer
    An interface for defining how a checksum is formed from a payload synchronously and asynchronously.

    The implementation may choose to also manipulate the request with the checksum, such as adding it as a header. Note: Currently, checksummers set the X_AMZ_CONTENT_SHA256 header for all requests. It is not strictly required to add the headers to all AWS requests - it's required for S3 and a couple of other select use cases. The pre-SRA implementation has a stricter set of rules for when to add the header. Being more restrictive with adding the header would require restructuring the signer / checksummer design.

    • Method Detail

      • create

        static Checksummer create()
        Get a default implementation of a checksummer, which calculates the SHA-256 checksum and places it in the x-amz-content-sha256 header.
      • forFlexibleChecksum

        static Checksummer forFlexibleChecksum​(ChecksumAlgorithm checksumAlgorithm)
        Get a flexible checksummer that performs two checksums: the given checksum-algorithm and the SHA-256 checksum. It places the SHA-256 checksum in x-amz-content-sha256 header, and the given checksum-algorithm in the x-amz-checksum-[name] header.
      • forPrecomputed256Checksum

        static Checksummer forPrecomputed256Checksum​(String precomputedSha256)
        Get a precomputed checksummer which places the precomputed checksum to the x-amz-content-sha256 header.
      • forFlexibleChecksum

        static Checksummer forFlexibleChecksum​(String precomputedSha256,
                                               ChecksumAlgorithm checksumAlgorithm)
        Get a flexible checksummer that performs two checksums: the given checksum-algorithm and a precomputed checksum from the given checksum string. It places the precomputed checksum in x-amz-content-sha256 header, and the given checksum-algorithm in the x-amz-checksum-[name] header.