diff --git a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumInputStream.java b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumInputStream.java index 625af50d4b56..0ec6acbdd526 100644 --- a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumInputStream.java +++ b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumInputStream.java @@ -23,6 +23,9 @@ import java.util.zip.Checksum; import software.amazon.awssdk.annotations.SdkInternalApi; +/** + * An input-stream that takes a collection of checksums, and updates each checksum when it reads data. + */ @SdkInternalApi public class ChecksumInputStream extends FilterInputStream { diff --git a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumSubscriber.java b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumSubscriber.java index 072abe63a202..c7671f8c91e4 100644 --- a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumSubscriber.java +++ b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/io/ChecksumSubscriber.java @@ -25,6 +25,9 @@ import org.reactivestreams.Subscription; import software.amazon.awssdk.annotations.SdkInternalApi; +/** + * A subscriber that takes a collection of checksums, and updates each checksum when it receives data. + */ @SdkInternalApi public final class ChecksumSubscriber implements Subscriber { private final CompletableFuture checksumming = new CompletableFuture<>(); diff --git a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/FlexibleChecksummer.java b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/FlexibleChecksummer.java index a7b2f56ea636..fac0b56f6d40 100644 --- a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/FlexibleChecksummer.java +++ b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/FlexibleChecksummer.java @@ -35,7 +35,9 @@ import software.amazon.awssdk.http.auth.aws.signer.Checksummer; /** - * A "flexible" implementation of a checksummer. + * A "flexible" implementation of a checksummer. It takes a map of checksums and their header names, computes them efficiently + * by updating each checksum while reading the payload (once), and adds the computed checksum strings to the request using the + * given header names in the map. This should be used in cases where a (flexible) checksum algorithm is present during signing. */ @SdkInternalApi public final class FlexibleChecksummer implements Checksummer { diff --git a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/PrecomputedChecksummer.java b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/PrecomputedChecksummer.java index e9adb3459f86..7a5fbb153ae8 100644 --- a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/PrecomputedChecksummer.java +++ b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/PrecomputedChecksummer.java @@ -28,8 +28,8 @@ /** * An implementation of a checksummer that simply passes along a computed value as a checksum. Specifically, this is used in - * the cases where the checksum is a pre-defined value that dictates specific behavior by the signer (such as aws-chunked - * payload signing, unsigned streaming with trailers, etc.). + * the cases where the checksum is a pre-defined value that dictates specific behavior by the signer, and flexible checksums is + * not enabled for the request (such as aws-chunked payload signing without trailers, unsigned streaming without trailers, etc.). */ @SdkInternalApi public final class PrecomputedChecksummer implements Checksummer { diff --git a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/signer/Checksummer.java b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/signer/Checksummer.java index c7baa06176bc..60531c93fecc 100644 --- a/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/signer/Checksummer.java +++ b/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/signer/Checksummer.java @@ -48,7 +48,7 @@ static Checksummer create() { } /** - * Get a flexible checksummer that uses the given checksum-algorithm and the default. + * Get a flexible checksummer that performs two checksums: the given checksum-algorithm and the default (sha256). */ static Checksummer create(ChecksumAlgorithm checksumAlgorithm) { if (checksumAlgorithm != null) { @@ -63,14 +63,15 @@ static Checksummer create(ChecksumAlgorithm checksumAlgorithm) { } /** - * Get a flexible checksummer that uses the given checksum-algorithm and the default. + * Get a precomputed checksummer that results the given checksum string. */ static Checksummer create(String checksum) { return new PrecomputedChecksummer(() -> checksum); } /** - * Get a flexible checksummer that uses the given checksum-algorithm and the default. + * Get a flexible checksummer that performs two checksums: the given checksum-algorithm and a precomputed checksum from the + * given checksum string. */ static Checksummer create(String checksum, ChecksumAlgorithm checksumAlgorithm) { if (checksumAlgorithm != null) {