@Override
    public Algorithm getEncryption(final Path file) throws BackgroundException {
        if(containerService.isContainer(file)) {
            final String key = String.format("s3.encryption.key.%s", containerService.getContainer(file).getName());
            if(StringUtils.isNotBlank(new HostPreferences(session.getHost()).getProperty(key))) {
                return Algorithm.fromString(new HostPreferences(session.getHost()).getProperty(key));
            }
        }
        return super.getEncryption(file);
    }
@Test
    public void testSetEncryptionKMSDefaultKeySignatureVersionV4() throws Exception {
        final Path container = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory));
        final S3AccessControlListFeature acl = new S3AccessControlListFeature(session);
        final Path test = new S3TouchFeature(session, acl).touch(new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final S3EncryptionFeature feature = new S3EncryptionFeature(session, acl);
        feature.setEncryption(test, KMSEncryptionFeature.SSE_KMS_DEFAULT);
        final Encryption.Algorithm value = feature.getEncryption(test);
        assertEquals("aws:kms", value.algorithm);
        assertNotNull(value.key);
        final PathAttributes attr = new S3AttributesFinderFeature(session, acl).find(test);
        assertNotEquals(Checksum.NONE, attr.getChecksum());
        assertNotNull(attr.getETag());
        assertNotEquals(Checksum.NONE, Checksum.parse(attr.getETag()));
        // The ETag will only be the MD5 of the object data when the object is stored as plaintext or encrypted using SSE-S3.
        // If the object is encrypted using another method (such as SSE-C or SSE-KMS) the ETag is not the MD5 of the object data.
        assertNotEquals("d41d8cd98f00b204e9800998ecf8427e", Checksum.parse(attr.getETag()).hash);
        new S3DefaultDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }