Pace2Car commented on code in PR #25009:
URL: https://github.com/apache/shardingsphere/pull/25009#discussion_r1168123655


##########
features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/encrypt/AESEncryptAlgorithm.java:
##########
@@ -50,8 +50,10 @@ public void init(final Properties props) {
     }
     
     private byte[] createSecretKey(final Properties props) {
-        ShardingSpherePreconditions.checkState(props.containsKey(AES_KEY), () 
-> new EncryptAlgorithmInitializationException("AES", String.format("%s can not 
be null", AES_KEY)));
-        return Arrays.copyOf(DigestUtils.sha1(props.getProperty(AES_KEY)), 16);
+        String aesKey = props.getProperty(AES_KEY);
+        ShardingSpherePreconditions.checkState(null != aesKey && 
!aesKey.isEmpty(),
+                () -> new EncryptAlgorithmInitializationException(getType(), 
String.format("%s can not be null or empty", AES_KEY)));

Review Comment:
   Please add a test case where AES_KEY is empty



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to