src/main/java/software/amazon/encryption/s3/materials/KmsDiscoveryKeyring.java [92:115]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @Override
    public byte[] decryptDataKey(DecryptionMaterials materials, byte[] encryptedDataKey) {
      Map<String, String> requestEncryptionContext = new HashMap<>();
      GetObjectRequest s3Request = materials.s3Request();
      if (s3Request.overrideConfiguration().isPresent()) {
        AwsRequestOverrideConfiguration overrideConfig = s3Request.overrideConfiguration().get();
        Optional<Map<String, String>> optEncryptionContext = overrideConfig
          .executionAttributes()
          .getOptionalAttribute(S3EncryptionClient.ENCRYPTION_CONTEXT);
        if (optEncryptionContext.isPresent()) {
          requestEncryptionContext = new HashMap<>(optEncryptionContext.get());
        }
      }

      // We are validating the encryption context to match S3EC V2 behavior
      // Refer to KMSMaterialsHandler in the V2 client for details
      Map<String, String> materialsEncryptionContextCopy = new HashMap<>(materials.encryptionContext());
      materialsEncryptionContextCopy.remove(KEY_ID_CONTEXT_KEY);
      materialsEncryptionContextCopy.remove(ENCRYPTION_CONTEXT_ALGORITHM_KEY);
      if (!materialsEncryptionContextCopy.equals(requestEncryptionContext)) {
        throw new S3EncryptionClientException("Provided encryption context does not match information retrieved from S3");
      }

      DecryptRequest request = DecryptRequest.builder()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/software/amazon/encryption/s3/materials/KmsKeyring.java [166:189]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        @Override
        public byte[] decryptDataKey(DecryptionMaterials materials, byte[] encryptedDataKey) {
            Map<String, String> requestEncryptionContext = new HashMap<>();
            GetObjectRequest s3Request = materials.s3Request();
            if (s3Request.overrideConfiguration().isPresent()) {
                AwsRequestOverrideConfiguration overrideConfig = s3Request.overrideConfiguration().get();
                Optional<Map<String, String>> optEncryptionContext = overrideConfig
                        .executionAttributes()
                        .getOptionalAttribute(S3EncryptionClient.ENCRYPTION_CONTEXT);
                if (optEncryptionContext.isPresent()) {
                    requestEncryptionContext = new HashMap<>(optEncryptionContext.get());
                }
            }

            // We are validating the encryption context to match S3EC V2 behavior
            // Refer to KMSMaterialsHandler in the V2 client for details
            Map<String, String> materialsEncryptionContextCopy = new HashMap<>(materials.encryptionContext());
            materialsEncryptionContextCopy.remove(KEY_ID_CONTEXT_KEY);
            materialsEncryptionContextCopy.remove(ENCRYPTION_CONTEXT_ALGORITHM_KEY);
            if (!materialsEncryptionContextCopy.equals(requestEncryptionContext)) {
                throw new S3EncryptionClientException("Provided encryption context does not match information retrieved from S3");
            }

            DecryptRequest request = DecryptRequest.builder()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



