You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/05/06 12:48:26 UTC

[shardingsphere] branch master updated: Add encrypt-sm module (#17393)

This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 1f9ff689949 Add encrypt-sm module (#17393)
1f9ff689949 is described below

commit 1f9ff689949e463de0367d8cfd27d9cecfb83ca1
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri May 6 20:48:13 2022 +0800

    Add encrypt-sm module (#17393)
    
    * Rename EncryptRule.setSchemaMetaData
    
    * Refactor SchemaMetaDataAwareEncryptAlgorithmFixture
    
    * Add encrypt-sm module
    
    * Add encrypt-sm module
    
    * Add encrypt-sm module
    
    * Add encrypt-sm module
---
 pom.xml                                            |  8 -----
 .../shardingsphere-encrypt/pom.xml                 |  1 +
 .../shardingsphere-encrypt-core/pom.xml            | 10 +++----
 .../encrypt/algorithm/AESEncryptAlgorithm.java     |  2 +-
 .../encrypt/algorithm/MD5EncryptAlgorithm.java     |  8 +++++
 .../encrypt/algorithm/RC4EncryptAlgorithm.java     | 35 +++++++---------------
 ...che.shardingsphere.encrypt.spi.EncryptAlgorithm |  2 --
 .../{ => shardingsphere-encrypt-plugin}/pom.xml    |  9 ++----
 .../shardingsphere-encrypt-sm}/pom.xml             | 28 +++++++++++------
 .../encrypt/sm}/algorithm/SM3EncryptAlgorithm.java |  2 +-
 .../encrypt/sm}/algorithm/SM4EncryptAlgorithm.java |  2 +-
 ...che.shardingsphere.encrypt.spi.EncryptAlgorithm |  7 ++---
 .../sm}/algorithm/SM3EncryptAlgorithmTest.java     |  2 +-
 .../sm}/algorithm/SM4EncryptAlgorithmTest.java     |  2 +-
 14 files changed, 54 insertions(+), 64 deletions(-)

diff --git a/pom.xml b/pom.xml
index bb6f176e522..59808d51165 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,8 +104,6 @@
         <opentelemetry.version>1.3.0</opentelemetry.version>
         <opentelemetry-autoconfigure.version>1.3.0-alpha</opentelemetry-autoconfigure.version>
         
-        <bcprov-jdk15on.version>1.70</bcprov-jdk15on.version>
-        
         <slf4j.version>1.7.7</slf4j.version>
         <logback.version>1.2.10</logback.version>
         
@@ -576,12 +574,6 @@
                 <scope>test</scope>
             </dependency>
             
-            <dependency>
-                <groupId>org.bouncycastle</groupId>
-                <artifactId>bcprov-jdk15on</artifactId>
-                <version>${bcprov-jdk15on.version}</version>
-            </dependency>
-            
             <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-api</artifactId>
diff --git a/shardingsphere-features/shardingsphere-encrypt/pom.xml b/shardingsphere-features/shardingsphere-encrypt/pom.xml
index 204c08c698e..a9cb14297fd 100644
--- a/shardingsphere-features/shardingsphere-encrypt/pom.xml
+++ b/shardingsphere-features/shardingsphere-encrypt/pom.xml
@@ -33,5 +33,6 @@
         <module>shardingsphere-encrypt-core</module>
         <module>shardingsphere-encrypt-distsql</module>
         <module>shardingsphere-encrypt-spring</module>
+        <module>shardingsphere-encrypt-plugin</module>
     </modules>
 </project>
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/pom.xml b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/pom.xml
index ebbd87caae8..b5454610032 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/pom.xml
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/pom.xml
@@ -53,6 +53,11 @@
             <artifactId>shardingsphere-infra-merge</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-encrypt-sm</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
@@ -65,10 +70,5 @@
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
         </dependency>
-        
-        <dependency>
-            <groupId>org.bouncycastle</groupId>
-            <artifactId>bcprov-jdk15on</artifactId>
-        </dependency>
     </dependencies>
 </project>
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/AESEncryptAlgorithm.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/AESEncryptAlgorithm.java
index 1a4032fa1ca..cad57ae62f2 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/AESEncryptAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/AESEncryptAlgorithm.java
@@ -47,7 +47,7 @@ public final class AESEncryptAlgorithm implements EncryptAlgorithm<Object, Strin
     @Setter
     private Properties props;
     
-    private byte[] secretKey;
+    private volatile byte[] secretKey;
     
     @Override
     public void init(final Properties props) {
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/MD5EncryptAlgorithm.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/MD5EncryptAlgorithm.java
index 9d420c957cc..4ae791cdb9c 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/MD5EncryptAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/MD5EncryptAlgorithm.java
@@ -17,15 +17,23 @@
 
 package org.apache.shardingsphere.encrypt.algorithm;
 
+import lombok.Getter;
+import lombok.Setter;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
 import org.apache.shardingsphere.encrypt.spi.context.EncryptContext;
 
+import java.util.Properties;
+
 /**
  * MD5 encrypt algorithm.
  */
+@Getter
+@Setter
 public final class MD5EncryptAlgorithm implements EncryptAlgorithm<Object, String> {
     
+    private Properties props;
+    
     @Override
     public String encrypt(final Object plainValue, final EncryptContext encryptContext) {
         return null == plainValue ? null : DigestUtils.md5Hex(String.valueOf(plainValue));
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/RC4EncryptAlgorithm.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/RC4EncryptAlgorithm.java
index 4832cfcfb59..49155f74118 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/RC4EncryptAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/RC4EncryptAlgorithm.java
@@ -43,9 +43,9 @@ public final class RC4EncryptAlgorithm implements EncryptAlgorithm<Object, Strin
     @Setter
     private Properties props;
     
-    private byte[] key = new byte[SBOX_LENGTH - 1];
+    private volatile byte[] key = new byte[SBOX_LENGTH - 1];
     
-    private int[] sBox = new int[SBOX_LENGTH];
+    private volatile int[] sBox = new int[SBOX_LENGTH];
     
     @Override
     public void init(final Properties props) {
@@ -53,6 +53,13 @@ public final class RC4EncryptAlgorithm implements EncryptAlgorithm<Object, Strin
         setKey(props.getProperty(RC4_KEY, "").getBytes(StandardCharsets.UTF_8));
     }
     
+    private void setKey(final byte[] key) throws ShardingSphereException {
+        if (!(key.length >= KEY_MIN_LENGTH && key.length < SBOX_LENGTH)) {
+            throw new ShardingSphereException("Key length has to be between " + KEY_MIN_LENGTH + " and " + (SBOX_LENGTH - 1));
+        }
+        this.key = key;
+    }
+    
     @Override
     public String encrypt(final Object plainValue, final EncryptContext encryptContext) {
         return null == plainValue ? null : Base64.encodeBase64String(handle(String.valueOf(plainValue).getBytes(StandardCharsets.UTF_8), key));
@@ -80,10 +87,7 @@ public final class RC4EncryptAlgorithm implements EncryptAlgorithm<Object, Strin
         Arrays.fill(sBox, 0);
     }
     
-    /**
-     * Crypt given byte array. Be aware, that you must init key, before using.
-     * @param message array to be crypt
-     * @return byte array
+    /*
      * @see <a href="http://en.wikipedia.org/wiki/RC4#Pseudo-random_generation_algorithm_.28PRGA.29">Pseudo-random generation algorithm</a>
      */
     private byte[] crypt(final byte[] message) {
@@ -101,11 +105,7 @@ public final class RC4EncryptAlgorithm implements EncryptAlgorithm<Object, Strin
         return result;
     }
     
-    /**
-     * Initialize SBOX with given key, Key-scheduling algorithm.
-     *
-     * @param key key
-     * @return sBox int array
+    /*
      * @see <a href="http://en.wikipedia.org/wiki/RC4#Key-scheduling_algorithm_.28KSA.29">Wikipedia. Init sBox</a>
      */
     private int[] initSBox(final byte[] key) {
@@ -127,19 +127,6 @@ public final class RC4EncryptAlgorithm implements EncryptAlgorithm<Object, Strin
         sBox[j] = temp;
     }
     
-    /**
-     * Set key.
-     *
-     * @param key key to be setup
-     * @throws ShardingSphereException if key length is smaller than 5 or bigger than 255
-     */
-    private void setKey(final byte[] key) throws ShardingSphereException {
-        if (!(key.length >= KEY_MIN_LENGTH && key.length < SBOX_LENGTH)) {
-            throw new ShardingSphereException("Key length has to be between " + KEY_MIN_LENGTH + " and " + (SBOX_LENGTH - 1));
-        }
-        this.key = key;
-    }
-    
     @Override
     public String getType() {
         return "RC4";
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
index 3ba0aed140c..c5f4e67267a 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
@@ -18,5 +18,3 @@
 org.apache.shardingsphere.encrypt.algorithm.MD5EncryptAlgorithm
 org.apache.shardingsphere.encrypt.algorithm.AESEncryptAlgorithm
 org.apache.shardingsphere.encrypt.algorithm.RC4EncryptAlgorithm
-org.apache.shardingsphere.encrypt.algorithm.SM3EncryptAlgorithm
-org.apache.shardingsphere.encrypt.algorithm.SM4EncryptAlgorithm
diff --git a/shardingsphere-features/shardingsphere-encrypt/pom.xml b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/pom.xml
similarity index 80%
copy from shardingsphere-features/shardingsphere-encrypt/pom.xml
copy to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/pom.xml
index 204c08c698e..0b9e0bb382f 100644
--- a/shardingsphere-features/shardingsphere-encrypt/pom.xml
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/pom.xml
@@ -21,17 +21,14 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-features</artifactId>
+        <artifactId>shardingsphere-encrypt</artifactId>
         <version>5.1.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-encrypt</artifactId>
+    <artifactId>shardingsphere-encrypt-plugin</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
     
     <modules>
-        <module>shardingsphere-encrypt-api</module>
-        <module>shardingsphere-encrypt-core</module>
-        <module>shardingsphere-encrypt-distsql</module>
-        <module>shardingsphere-encrypt-spring</module>
+        <module>shardingsphere-encrypt-sm</module>
     </modules>
 </project>
diff --git a/shardingsphere-features/shardingsphere-encrypt/pom.xml b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/pom.xml
similarity index 65%
copy from shardingsphere-features/shardingsphere-encrypt/pom.xml
copy to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/pom.xml
index 204c08c698e..d7dccfd8b5d 100644
--- a/shardingsphere-features/shardingsphere-encrypt/pom.xml
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/pom.xml
@@ -21,17 +21,27 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-features</artifactId>
+        <artifactId>shardingsphere-encrypt-plugin</artifactId>
         <version>5.1.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-encrypt</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>shardingsphere-encrypt-sm</artifactId>
     <name>${project.artifactId}</name>
     
-    <modules>
-        <module>shardingsphere-encrypt-api</module>
-        <module>shardingsphere-encrypt-core</module>
-        <module>shardingsphere-encrypt-distsql</module>
-        <module>shardingsphere-encrypt-spring</module>
-    </modules>
+    <properties>
+        <bcprov-jdk15on.version>1.70</bcprov-jdk15on.version>
+    </properties>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-encrypt-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk15on</artifactId>
+            <version>${bcprov-jdk15on.version}</version>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/SM3EncryptAlgorithm.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM3EncryptAlgorithm.java
similarity index 98%
rename from shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/SM3EncryptAlgorithm.java
rename to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM3EncryptAlgorithm.java
index 04bd5f0f4a6..aedfca08244 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/SM3EncryptAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM3EncryptAlgorithm.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.encrypt.algorithm;
+package org.apache.shardingsphere.encrypt.sm.algorithm;
 
 import com.google.common.base.Preconditions;
 import lombok.Getter;
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/SM4EncryptAlgorithm.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java
similarity index 99%
rename from shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/SM4EncryptAlgorithm.java
rename to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java
index c426fb6ac9b..e06269a9907 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/SM4EncryptAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.encrypt.algorithm;
+package org.apache.shardingsphere.encrypt.sm.algorithm;
 
 import com.google.common.base.Preconditions;
 import lombok.Getter;
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
similarity index 71%
copy from shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
copy to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
index 3ba0aed140c..630f75247d1 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/main/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm
@@ -15,8 +15,5 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.encrypt.algorithm.MD5EncryptAlgorithm
-org.apache.shardingsphere.encrypt.algorithm.AESEncryptAlgorithm
-org.apache.shardingsphere.encrypt.algorithm.RC4EncryptAlgorithm
-org.apache.shardingsphere.encrypt.algorithm.SM3EncryptAlgorithm
-org.apache.shardingsphere.encrypt.algorithm.SM4EncryptAlgorithm
+org.apache.shardingsphere.encrypt.sm.algorithm.SM3EncryptAlgorithm
+org.apache.shardingsphere.encrypt.sm.algorithm.SM4EncryptAlgorithm
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/SM3EncryptAlgorithmTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/test/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM3EncryptAlgorithmTest.java
similarity index 98%
rename from shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/SM3EncryptAlgorithmTest.java
rename to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/test/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM3EncryptAlgorithmTest.java
index ee139ee9a12..251eb61581b 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/SM3EncryptAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/test/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM3EncryptAlgorithmTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.encrypt.algorithm;
+package org.apache.shardingsphere.encrypt.sm.algorithm;
 
 import org.apache.shardingsphere.encrypt.factory.EncryptAlgorithmFactory;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/SM4EncryptAlgorithmTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/test/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithmTest.java
similarity index 98%
rename from shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/SM4EncryptAlgorithmTest.java
rename to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/test/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithmTest.java
index 7eb87ba3020..078d40a225f 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/SM4EncryptAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-plugin/shardingsphere-encrypt-sm/src/test/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithmTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.encrypt.algorithm;
+package org.apache.shardingsphere.encrypt.sm.algorithm;
 
 import org.apache.shardingsphere.encrypt.factory.EncryptAlgorithmFactory;
 import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;