From 251c58adf419500f29d45f94cca1ae89cb275e23 Mon Sep 17 00:00:00 2001 From: Cong Hu Date: Tue, 23 Jul 2024 18:41:24 +0800 Subject: [PATCH] Change the digest-algorithm-name property of AESEncryptAlgorithm to require. --- .../builtin-algorithm/encrypt.cn.md | 8 +++--- .../builtin-algorithm/encrypt.en.md | 8 +++--- .../config/EncryptRuleConfiguration.java | 27 ++----------------- .../encrypt/spi/EncryptAlgorithmMetaData.java | 4 --- .../assisted/MD5AssistedEncryptAlgorithm.java | 2 +- .../standard/AESEncryptAlgorithm.java | 14 +++------- .../standard/AESEncryptAlgorithmTest.java | 22 ++++----------- .../fixture/CoreEncryptAlgorithmFixture.java | 4 +-- ...eQueryAssistedEncryptAlgorithmFixture.java | 4 +-- .../CoreQueryLikeEncryptAlgorithmFixture.java | 4 +-- .../encrypt/rule/EncryptRuleTest.java | 13 --------- .../src/test/resources/yaml/encrypt-rule.yaml | 2 ++ .../DistSQLEncryptAlgorithmFixture.java | 4 +-- .../update/CreateEncryptRuleExecutorTest.java | 2 +- .../infra/spi/type/typed/TypedSPILoader.java | 20 -------------- .../conf/config_loader/database-encrypt.yaml | 1 + .../conf/convert/database-encrypt.yaml | 1 + .../resources/conf/convert/database-mix.yaml | 1 + .../conf/import/database-encrypt.yaml | 1 + .../main/resources/conf/database-encrypt.yaml | 1 + .../encrypt/JDBCEncryptAlgorithmFixture.java | 4 +-- ...CQueryAssistedEncryptAlgorithmFixture.java | 4 +-- .../ITEncryptLikeAlgorithmFixture.java | 2 +- ...-with-readwrite-splitting-and-encrypt.yaml | 1 + ...-with-readwrite-splitting-and-encrypt.yaml | 1 + ...-with-readwrite-splitting-and-encrypt.yaml | 1 + .../rules.yaml | 1 + .../proxy/conf/mysql/database-encrypt.yaml | 1 + .../conf/opengauss/database-encrypt.yaml | 1 + .../conf/postgresql/database-encrypt.yaml | 1 + .../resources/env/scenario/encrypt/rules.yaml | 1 + .../database-encrypt-readwrite-splitting.yaml | 1 + .../database-encrypt-readwrite-splitting.yaml | 1 + .../database-encrypt-readwrite-splitting.yaml | 1 + .../rules.yaml | 1 + .../conf/mysql/database-encrypt-shadow.yaml | 1 + .../opengauss/database-encrypt-shadow.yaml | 1 + .../postgresql/database-encrypt-shadow.yaml | 1 + .../env/scenario/encrypt_shadow/rules.yaml | 1 + .../conf/mysql/database-mask-encrypt.yaml | 1 + .../conf/opengauss/database-mask-encrypt.yaml | 1 + .../postgresql/database-mask-encrypt.yaml | 1 + .../env/scenario/mask_encrypt/rules.yaml | 1 + .../mysql/database-mask-encrypt-sharding.yaml | 1 + .../database-mask-encrypt-sharding.yaml | 1 + .../database-mask-encrypt-sharding.yaml | 1 + .../scenario/mask_encrypt_sharding/rules.yaml | 1 + .../mysql/database-sharding-and-encrypt.yaml | 1 + .../database-sharding-and-encrypt.yaml | 1 + .../database-sharding-and-encrypt.yaml | 1 + .../scenario/sharding_and_encrypt/rules.yaml | 1 + .../database-sharding-encrypt-shadow.yaml | 1 + .../database-sharding-encrypt-shadow.yaml | 1 + .../database-sharding-encrypt-shadow.yaml | 1 + .../sharding_encrypt_shadow/rules.yaml | 1 + .../RewriteEncryptLikeAlgorithmFixture.java | 2 +- .../RewriteNormalEncryptAlgorithmFixture.java | 4 +-- ...eQueryAssistedEncryptAlgorithmFixture.java | 4 +-- ...writeQueryLikeEncryptAlgorithmFixture.java | 4 +-- .../encrypt/config/query-with-cipher.yaml | 1 + ...QueryAssistedShardingEncryptAlgorithm.java | 4 +-- .../test-native/yaml/features/encrypt.yaml | 3 ++- 62 files changed, 74 insertions(+), 133 deletions(-) diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.cn.md b/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.cn.md index b28f71cf534379..06e3b98a9bbe9b 100644 --- a/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.cn.md +++ b/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.cn.md @@ -17,10 +17,10 @@ weight = 5 可配置属性: -| *名称* | *数据类型* | *说明* | -|-----------------------|--------|------------------------------| -| aes-key-value | String | AES 使用的 KEY | -| digest-algorithm-name | String | AES KEY 的摘要算法 (可选,默认值:SHA-1) | +| *名称* | *数据类型* | *说明* | +|-----------------------|--------|---------------| +| aes-key-value | String | AES 使用的 KEY | +| digest-algorithm-name | String | AES KEY 的摘要算法 | ### 辅助查询加密算法 diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.en.md b/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.en.md index ef973157ee88db..d0199ae8f74f52 100644 --- a/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.en.md +++ b/docs/document/content/user-manual/common-config/builtin-algorithm/encrypt.en.md @@ -17,10 +17,10 @@ Type: AES Attributes: -| *Name* | *DataType* | *Description* | -|-----------------------|------------|-----------------------------------------------------| -| aes-key-value | String | AES KEY | -| digest-algorithm-name | String | AES KEY DIGEST ALGORITHM (optional, default: SHA-1) | +| *Name* | *DataType* | *Description* | +|-----------------------|------------|--------------------------| +| aes-key-value | String | AES KEY | +| digest-algorithm-name | String | AES KEY DIGEST ALGORITHM | ### Assisted Encrypt Algorithm diff --git a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/config/EncryptRuleConfiguration.java b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/config/EncryptRuleConfiguration.java index 744f1f216cec66..3b56adb14e867c 100644 --- a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/config/EncryptRuleConfiguration.java +++ b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/config/EncryptRuleConfiguration.java @@ -18,23 +18,19 @@ package org.apache.shardingsphere.encrypt.config; import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.encrypt.config.rule.EncryptTableRuleConfiguration; -import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm; -import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.config.rule.function.EnhancedRuleConfiguration; import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration; -import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import java.util.Collection; -import java.util.HashMap; import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; /** * Encrypt rule configuration. */ +@RequiredArgsConstructor @Getter public final class EncryptRuleConfiguration implements DatabaseRuleConfiguration, EnhancedRuleConfiguration { @@ -42,25 +38,6 @@ public final class EncryptRuleConfiguration implements DatabaseRuleConfiguration private final Map encryptors; - public EncryptRuleConfiguration(final Collection tables, final Map encryptors) { - this.tables = tables; - this.encryptors = rebuildEncryptorsWithDefaultProperties(encryptors); - } - - private Map rebuildEncryptorsWithDefaultProperties(final Map encryptors) { - Map result = new HashMap<>(encryptors.size(), 1F); - for (Entry entry : encryptors.entrySet()) { - // todo Replace with MultiSourceProperties, MultiSourceProperties need support marshal. - Properties props = new Properties(); - props.putAll(entry.getValue().getProps()); - Properties defaultProps = TypedSPILoader.findUninitedService(EncryptAlgorithm.class, entry.getValue().getType()).map(EncryptAlgorithm::getMetaData) - .map(EncryptAlgorithmMetaData::getDefaultProps).orElseGet(Properties::new); - defaultProps.forEach(props::putIfAbsent); - result.put(entry.getKey(), new AlgorithmConfiguration(entry.getValue().getType(), props)); - } - return result; - } - @Override public boolean isEmpty() { return tables.isEmpty(); diff --git a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java index c3c8eebae973a3..557ed66ace5870 100644 --- a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java +++ b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java @@ -21,8 +21,6 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import java.util.Properties; - /** * Encrypt algorithm meta data. */ @@ -36,6 +34,4 @@ public final class EncryptAlgorithmMetaData { private final boolean supportEquivalentFilter; private final boolean supportLike; - - private final Properties defaultProps; } diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java index 474ab334afeb12..1a9d9c28279276 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java @@ -34,7 +34,7 @@ public final class MD5AssistedEncryptAlgorithm implements EncryptAlgorithm { @Getter - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false); private MessageDigestAlgorithm digestAlgorithm; diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java index fe55f067bf813a..228c22b8620db0 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java @@ -21,13 +21,11 @@ import lombok.Getter; import lombok.SneakyThrows; import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.codec.digest.MessageDigestAlgorithms; import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm; import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; import org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; -import org.apache.shardingsphere.infra.util.props.MultiSourceProperties; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; @@ -48,26 +46,20 @@ public final class AESEncryptAlgorithm implements EncryptAlgorithm { private static final String DIGEST_ALGORITHM_NAME = "digest-algorithm-name"; @Getter - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false, getDefaultProperties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); private byte[] secretKey; - private Properties getDefaultProperties() { - Properties result = new Properties(); - result.setProperty(DIGEST_ALGORITHM_NAME, MessageDigestAlgorithms.SHA_1); - return result; - } - @Override public void init(final Properties props) { - Properties multiSourceProperties = new MultiSourceProperties(props, metaData.getDefaultProps()); - secretKey = getSecretKey(multiSourceProperties); + secretKey = getSecretKey(props); } private byte[] getSecretKey(final Properties props) { String aesKey = props.getProperty(AES_KEY); ShardingSpherePreconditions.checkNotEmpty(aesKey, () -> new AlgorithmInitializationException(this, "%s can not be null or empty", AES_KEY)); String digestAlgorithm = props.getProperty(DIGEST_ALGORITHM_NAME); + ShardingSpherePreconditions.checkNotEmpty(digestAlgorithm, () -> new AlgorithmInitializationException(this, "%s can not be null or empty", DIGEST_ALGORITHM_NAME)); return Arrays.copyOf(DigestUtils.getDigest(digestAlgorithm.toUpperCase()).digest(aesKey.getBytes(StandardCharsets.UTF_8)), 16); } diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java index f8d8cc9bb4c41d..7eab0b6bdbeed4 100644 --- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java +++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java @@ -26,11 +26,9 @@ import org.apache.shardingsphere.test.util.PropertiesBuilder.Property; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.mockito.Answers; import org.mockito.MockedStatic; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertNull; @@ -45,27 +43,17 @@ class AESEncryptAlgorithmTest { @BeforeEach void setUp() { - encryptAlgorithm = TypedSPILoader.getService(EncryptAlgorithm.class, "AES", PropertiesBuilder.build(new Property("aes-key-value", "test"))); + encryptAlgorithm = TypedSPILoader.getService(EncryptAlgorithm.class, "AES", PropertiesBuilder.build(new Property("aes-key-value", "test"), new Property("digest-algorithm-name", "SHA-1"))); } @Test - void assertDefaultDigestAlgorithm() throws NoSuchAlgorithmException { - MockedStatic digestUtilsMockedStatic = mockStatic(DigestUtils.class); - digestUtilsMockedStatic.when(() -> DigestUtils.getDigest("SHA-1")).thenReturn(MessageDigest.getInstance("SHA-1")); - TypedSPILoader.getService(EncryptAlgorithm.class, "AES", PropertiesBuilder.build(new Property("aes-key-value", "test"))); + void assertDigestAlgorithm() { + MockedStatic digestUtilsMockedStatic = mockStatic(DigestUtils.class, Answers.CALLS_REAL_METHODS); + TypedSPILoader.getService(EncryptAlgorithm.class, "AES", PropertiesBuilder.build(new Property("aes-key-value", "test"), new Property("digest-algorithm-name", "SHA-1"))); digestUtilsMockedStatic.verify(() -> DigestUtils.getDigest("SHA-1"), times(1)); digestUtilsMockedStatic.close(); } - @Test - void assertSHA512DigestAlgorithm() throws NoSuchAlgorithmException { - MockedStatic digestUtilsMockedStatic = mockStatic(DigestUtils.class); - digestUtilsMockedStatic.when(() -> DigestUtils.getDigest("SHA-512")).thenReturn(MessageDigest.getInstance("SHA-512")); - TypedSPILoader.getService(EncryptAlgorithm.class, "AES", PropertiesBuilder.build(new Property("aes-key-value", "test"), new Property("digest-algorithm-name", "SHA-512"))); - digestUtilsMockedStatic.verify(() -> DigestUtils.getDigest("SHA-512"), times(1)); - digestUtilsMockedStatic.close(); - } - @Test void assertCreateNewInstanceWithoutAESKey() { assertThrows(AlgorithmInitializationException.class, () -> TypedSPILoader.getService(EncryptAlgorithm.class, "AES")); diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java index 217a205948f593..1a817ef8bdabb3 100644 --- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java +++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class CoreEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java index 0ed7c190530818..d91d66573c8872 100644 --- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java +++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class CoreQueryAssistedEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java index a3c5a8a80af4cf..6295a91591e7a4 100644 --- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java +++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class CoreQueryLikeEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, false, true, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, false, true); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java index 57e1e0e1112455..a38f1160aa46c4 100644 --- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java +++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java @@ -17,7 +17,6 @@ package org.apache.shardingsphere.encrypt.rule; -import org.apache.commons.codec.digest.MessageDigestAlgorithms; import org.apache.shardingsphere.encrypt.config.EncryptRuleConfiguration; import org.apache.shardingsphere.encrypt.config.rule.EncryptColumnItemRuleConfiguration; import org.apache.shardingsphere.encrypt.config.rule.EncryptColumnRuleConfiguration; @@ -94,18 +93,6 @@ void assertLikeQueryEncryptorNameSpecified() { assertThat(pwdColumnConfig.getLikeQuery().get().getEncryptorName(), is("like_query_test_encryptor")); } - @Test - void assertAESEncryptRuleDefaultProps() { - EncryptRuleConfiguration defaultPropsEncryptRuleConfig = new EncryptRuleConfiguration(Collections.emptyList(), - Collections.singletonMap("aes_encryptor", new AlgorithmConfiguration("AES", new Properties()))); - assertThat(defaultPropsEncryptRuleConfig.getEncryptors().get("aes_encryptor").getProps().getProperty(DIGEST_ALGORITHM_NAME), is(MessageDigestAlgorithms.SHA_1)); - Properties props = new Properties(); - props.put(DIGEST_ALGORITHM_NAME, MessageDigestAlgorithms.SHA_256); - EncryptRuleConfiguration sha256EncryptRuleConfig = new EncryptRuleConfiguration(Collections.emptyList(), - Collections.singletonMap("aes_encryptor", new AlgorithmConfiguration("AES", props))); - assertThat(sha256EncryptRuleConfig.getEncryptors().get("aes_encryptor").getProps().getProperty(DIGEST_ALGORITHM_NAME), is(MessageDigestAlgorithms.SHA_256)); - } - private Map getEncryptors(final AlgorithmConfiguration standardEncryptConfig, final AlgorithmConfiguration queryAssistedEncryptConfig, final AlgorithmConfiguration queryLikeEncryptConfig) { Map result = new HashMap<>(3, 1F); diff --git a/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml b/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml index dd8f745457f498..d60b40d2d25ffc 100644 --- a/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml +++ b/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml @@ -32,7 +32,9 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 assisted_encryptor: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java index 3225950e500522..5a331f4553e63d 100644 --- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java +++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class DistSQLEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java index 5a3b0b72d21d05..7f3faf8a04cd39 100644 --- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java +++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java @@ -88,7 +88,7 @@ void assertCreateEncryptRuleWithIfNotExists() { private CreateEncryptRuleStatement createAESEncryptRuleSQLStatement(final boolean ifNotExists) { EncryptColumnSegment encryptColumnSegment = new EncryptColumnSegment("user_id", - new EncryptColumnItemSegment("user_cipher", new AlgorithmSegment("AES", PropertiesBuilder.build(new Property("aes-key-value", "abc")))), + new EncryptColumnItemSegment("user_cipher", new AlgorithmSegment("AES", PropertiesBuilder.build(new Property("aes-key-value", "abc"), new Property("digest-algorithm-name", "SHA-1")))), new EncryptColumnItemSegment("assisted_column", null), new EncryptColumnItemSegment("like_column", null)); Collection rules = new LinkedList<>(); diff --git a/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java b/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java index 08b1177c7c43eb..4d0c534e75e788 100644 --- a/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java +++ b/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java @@ -65,26 +65,6 @@ public static Optional findService(final Class servic return Optional.empty(); } - /** - * Find uninited service. - * - * @param serviceInterface typed SPI service interface - * @param type type - * @param SPI class type - * @return found service - */ - public static Optional findUninitedService(final Class serviceInterface, final Object type) { - if (null == type) { - return findDefaultService(serviceInterface); - } - for (T each : ShardingSphereServiceLoader.getServiceInstances(serviceInterface)) { - if (matchesType(type, each)) { - return Optional.of(each); - } - } - return Optional.empty(); - } - private static Optional findDefaultService(final Class serviceInterface) { for (T each : ShardingSphereServiceLoader.getServiceInstances(serviceInterface)) { if (!each.isDefault()) { diff --git a/proxy/backend/core/src/test/resources/conf/config_loader/database-encrypt.yaml b/proxy/backend/core/src/test/resources/conf/config_loader/database-encrypt.yaml index b039f42205b367..0dd2c560e8c7ef 100644 --- a/proxy/backend/core/src/test/resources/conf/config_loader/database-encrypt.yaml +++ b/proxy/backend/core/src/test/resources/conf/config_loader/database-encrypt.yaml @@ -46,3 +46,4 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 diff --git a/proxy/backend/core/src/test/resources/conf/convert/database-encrypt.yaml b/proxy/backend/core/src/test/resources/conf/convert/database-encrypt.yaml index b5402a83f6856c..373de309cc1c76 100644 --- a/proxy/backend/core/src/test/resources/conf/convert/database-encrypt.yaml +++ b/proxy/backend/core/src/test/resources/conf/convert/database-encrypt.yaml @@ -44,6 +44,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 like_encryptor: type: CORE.QUERY_LIKE.FIXTURE tables: diff --git a/proxy/backend/core/src/test/resources/conf/convert/database-mix.yaml b/proxy/backend/core/src/test/resources/conf/convert/database-mix.yaml index 1d48e74363b7d2..6609a270eae3f3 100644 --- a/proxy/backend/core/src/test/resources/conf/convert/database-mix.yaml +++ b/proxy/backend/core/src/test/resources/conf/convert/database-mix.yaml @@ -128,6 +128,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_encrypt: columns: diff --git a/proxy/backend/core/src/test/resources/conf/import/database-encrypt.yaml b/proxy/backend/core/src/test/resources/conf/import/database-encrypt.yaml index 8db3648f7d7bbf..bbcba986dda02a 100644 --- a/proxy/backend/core/src/test/resources/conf/import/database-encrypt.yaml +++ b/proxy/backend/core/src/test/resources/conf/import/database-encrypt.yaml @@ -46,6 +46,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_encrypt: columns: diff --git a/proxy/bootstrap/src/main/resources/conf/database-encrypt.yaml b/proxy/bootstrap/src/main/resources/conf/database-encrypt.yaml index 0132c7b0a2e287..f72593a56b2b23 100644 --- a/proxy/bootstrap/src/main/resources/conf/database-encrypt.yaml +++ b/proxy/bootstrap/src/main/resources/conf/database-encrypt.yaml @@ -98,6 +98,7 @@ # type: AES # props: # aes-key-value: 123456abc +# digest-algorithm-name: SHA-1 # tables: # t_encrypt: # columns: diff --git a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java index afc013ee7b808f..22e04596b5c71b 100644 --- a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java +++ b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class JDBCEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java index 1fdf369fdd92d3..76835ff853701d 100644 --- a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java +++ b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class JDBCQueryAssistedEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java index f6bba771213bf9..51ab4fa60b5a4b 100644 --- a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java +++ b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java @@ -53,7 +53,7 @@ public final class ITEncryptLikeAlgorithmFixture implements EncryptAlgorithm { private static final int MAX_NUMERIC_LETTER_CHAR = 255; @Getter - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, true, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, true); private int delta; diff --git a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/mysql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/mysql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml index 8af27775556bfa..92696046e61149 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/mysql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/mysql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml @@ -359,6 +359,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/opengauss/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/opengauss/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml index f4d0e4ffb642a3..31304f65f45b4b 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/opengauss/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/opengauss/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml @@ -358,6 +358,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/postgresql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/postgresql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml index f6b4f034731ba6..1cc40d88c2406c 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/postgresql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/conf/postgresql/database-dbtbl-with-readwrite-splitting-and-encrypt.yaml @@ -358,6 +358,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/rules.yaml index 36c3802a4ef53d..0cc032bf64518f 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/rules.yaml @@ -170,6 +170,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/mysql/database-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/mysql/database-encrypt.yaml index ee5acbda66843a..e6117f6d8d8968 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/mysql/database-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/mysql/database-encrypt.yaml @@ -38,6 +38,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 like_encryptor: type: IT.ENCRYPT.LIKE.FIXTURE props: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/opengauss/database-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/opengauss/database-encrypt.yaml index ed3a7d99c7c900..fb0ddc0f888819 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/opengauss/database-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/opengauss/database-encrypt.yaml @@ -38,6 +38,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 like_encryptor: type: IT.ENCRYPT.LIKE.FIXTURE props: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/postgresql/database-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/postgresql/database-encrypt.yaml index a5030de3a717fe..95964326845938 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/postgresql/database-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt/proxy/conf/postgresql/database-encrypt.yaml @@ -38,6 +38,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 like_encryptor: type: IT.ENCRYPT.LIKE.FIXTURE props: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt/rules.yaml index a4c0b5294e469c..fd9c35a3ab5084 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt/rules.yaml @@ -25,6 +25,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 like_encryptor: type: IT.ENCRYPT.LIKE.FIXTURE props: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/mysql/database-encrypt-readwrite-splitting.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/mysql/database-encrypt-readwrite-splitting.yaml index 3ebb3fdc1b9889..75ff973caba4f5 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/mysql/database-encrypt-readwrite-splitting.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/mysql/database-encrypt-readwrite-splitting.yaml @@ -58,6 +58,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/opengauss/database-encrypt-readwrite-splitting.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/opengauss/database-encrypt-readwrite-splitting.yaml index b6ec04773ac84f..37b847dab951b7 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/opengauss/database-encrypt-readwrite-splitting.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/opengauss/database-encrypt-readwrite-splitting.yaml @@ -58,6 +58,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/postgresql/database-encrypt-readwrite-splitting.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/postgresql/database-encrypt-readwrite-splitting.yaml index 2502c0d615fb93..965c17a239f094 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/postgresql/database-encrypt-readwrite-splitting.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/proxy/conf/postgresql/database-encrypt-readwrite-splitting.yaml @@ -58,6 +58,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/rules.yaml index e81438a24654ad..bd6b8e125a4dbf 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_and_readwrite_splitting/rules.yaml @@ -36,6 +36,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/mysql/database-encrypt-shadow.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/mysql/database-encrypt-shadow.yaml index 1709fb1f10ffab..0e21fa0738d58f 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/mysql/database-encrypt-shadow.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/mysql/database-encrypt-shadow.yaml @@ -125,6 +125,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/opengauss/database-encrypt-shadow.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/opengauss/database-encrypt-shadow.yaml index e2cd01be5f83be..ce47764155b289 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/opengauss/database-encrypt-shadow.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/opengauss/database-encrypt-shadow.yaml @@ -124,6 +124,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/postgresql/database-encrypt-shadow.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/postgresql/database-encrypt-shadow.yaml index 22f1a8e4ba9b8a..6412c5aabd030c 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/postgresql/database-encrypt-shadow.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/postgresql/database-encrypt-shadow.yaml @@ -124,6 +124,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/rules.yaml index 3027b606fc1855..9dd2ad774738e5 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/encrypt_shadow/rules.yaml @@ -103,6 +103,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/mysql/database-mask-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/mysql/database-mask-encrypt.yaml index 9c2c17c503e371..580e39e60ef4eb 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/mysql/database-mask-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/mysql/database-mask-encrypt.yaml @@ -62,6 +62,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/opengauss/database-mask-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/opengauss/database-mask-encrypt.yaml index 923f8dbd2918dc..29398e01d2e1cd 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/opengauss/database-mask-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/opengauss/database-mask-encrypt.yaml @@ -62,6 +62,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/postgresql/database-mask-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/postgresql/database-mask-encrypt.yaml index 8383db0fe6bf68..75f8d874b34609 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/postgresql/database-mask-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/proxy/conf/postgresql/database-mask-encrypt.yaml @@ -62,6 +62,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/rules.yaml index f8135b9567987d..51efa3f3988a38 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt/rules.yaml @@ -49,6 +49,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/mysql/database-mask-encrypt-sharding.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/mysql/database-mask-encrypt-sharding.yaml index a051358fb7a93d..609f3159250e2d 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/mysql/database-mask-encrypt-sharding.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/mysql/database-mask-encrypt-sharding.yaml @@ -143,6 +143,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/opengauss/database-mask-encrypt-sharding.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/opengauss/database-mask-encrypt-sharding.yaml index b1b323bf71b63b..100395752539f0 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/opengauss/database-mask-encrypt-sharding.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/opengauss/database-mask-encrypt-sharding.yaml @@ -143,6 +143,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/postgresql/database-mask-encrypt-sharding.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/postgresql/database-mask-encrypt-sharding.yaml index af22efdcf1aabd..3791896622292f 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/postgresql/database-mask-encrypt-sharding.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/postgresql/database-mask-encrypt-sharding.yaml @@ -143,6 +143,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/rules.yaml index ef8d76e643bf64..705cd0fd8da6d3 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/mask_encrypt_sharding/rules.yaml @@ -49,6 +49,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/mysql/database-sharding-and-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/mysql/database-sharding-and-encrypt.yaml index 5cf05cde67f40a..36b88306a90979 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/mysql/database-sharding-and-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/mysql/database-sharding-and-encrypt.yaml @@ -213,6 +213,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/opengauss/database-sharding-and-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/opengauss/database-sharding-and-encrypt.yaml index 2f6f1782656113..2d6296c3ffa747 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/opengauss/database-sharding-and-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/opengauss/database-sharding-and-encrypt.yaml @@ -213,6 +213,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/postgresql/database-sharding-and-encrypt.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/postgresql/database-sharding-and-encrypt.yaml index 94bdde57eecb81..01d46c94411b88 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/postgresql/database-sharding-and-encrypt.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/conf/postgresql/database-sharding-and-encrypt.yaml @@ -213,6 +213,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/rules.yaml index 631f73404a7911..175485bcae88d9 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/rules.yaml @@ -119,6 +119,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_user: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/mysql/database-sharding-encrypt-shadow.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/mysql/database-sharding-encrypt-shadow.yaml index 4b4cbe9c34d1de..8e23067cec1708 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/mysql/database-sharding-encrypt-shadow.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/mysql/database-sharding-encrypt-shadow.yaml @@ -307,6 +307,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/opengauss/database-sharding-encrypt-shadow.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/opengauss/database-sharding-encrypt-shadow.yaml index 4a61fecb6075fa..138fc9133d26e9 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/opengauss/database-sharding-encrypt-shadow.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/opengauss/database-sharding-encrypt-shadow.yaml @@ -307,6 +307,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/postgresql/database-sharding-encrypt-shadow.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/postgresql/database-sharding-encrypt-shadow.yaml index 86c64207d76e53..7f77b91d2ab436 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/postgresql/database-sharding-encrypt-shadow.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/proxy/conf/postgresql/database-sharding-encrypt-shadow.yaml @@ -307,6 +307,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/rules.yaml index 670d1f8ee73135..0db62d1c5ed534 100644 --- a/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/rules.yaml +++ b/test/e2e/sql/src/test/resources/env/scenario/sharding_encrypt_shadow/rules.yaml @@ -123,6 +123,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 tables: t_shadow: columns: diff --git a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java index c23e7f9ee17f19..12f9dd31a48c1b 100644 --- a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java +++ b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java @@ -53,7 +53,7 @@ public final class RewriteEncryptLikeAlgorithmFixture implements EncryptAlgorith private static final int MAX_NUMERIC_LETTER_CHAR = 255; @Getter - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, true, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, true); private int delta; diff --git a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java index 8c8c65dd3c99a3..3cc88541078c1d 100644 --- a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java +++ b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class RewriteNormalEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java index 27950fb3e4178c..e3c1a88245cfb0 100644 --- a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java +++ b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class RewriteQueryAssistedEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java index c2cccdbab1c349..21913c0ac51b37 100644 --- a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java +++ b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class RewriteQueryLikeEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, true, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, true); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml b/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml index c0ee0ebf2cf8f9..7a0a5660d55125 100644 --- a/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml +++ b/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml @@ -137,6 +137,7 @@ rules: type: AES props: aes-key-value: 123456abc + digest-algorithm-name: SHA-1 rewrite_it_like_encryptor_fixture: type: IT.ENCRYPT.LIKE.FIXTURE props: diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java index 2743bb1d4f8c1c..3bbf6ee484669b 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java @@ -22,12 +22,10 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData; import org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext; -import java.util.Properties; - @Getter public final class TestQueryAssistedShardingEncryptAlgorithm implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false, new Properties()); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(false, true, false); @Override public String encrypt(final Object plainValue, final AlgorithmSQLContext algorithmSQLContext) { diff --git a/test/native/src/test/resources/test-native/yaml/features/encrypt.yaml b/test/native/src/test/resources/test-native/yaml/features/encrypt.yaml index dfe52b7f685361..9ae9b794b0d674 100644 --- a/test/native/src/test/resources/test-native/yaml/features/encrypt.yaml +++ b/test/native/src/test/resources/test-native/yaml/features/encrypt.yaml @@ -51,10 +51,11 @@ rules: type: AES props: aes-key-value: 123456 + digest-algorithm-name: SHA-1 assisted_encryptor: type: assistedTest props: aes-key-value: 123456 - + digest-algorithm-name: SHA-1 props: sql-show: false