diff --git a/java/tsfile/src/main/java/org/apache/tsfile/encrypt/EncryptUtils.java b/java/tsfile/src/main/java/org/apache/tsfile/encrypt/EncryptUtils.java index 7bd28718d..9b14debdc 100644 --- a/java/tsfile/src/main/java/org/apache/tsfile/encrypt/EncryptUtils.java +++ b/java/tsfile/src/main/java/org/apache/tsfile/encrypt/EncryptUtils.java @@ -92,6 +92,13 @@ public static String getEncryptKeyFromPath(String path) { if (str.isEmpty()) { return defaultKey; } + if (str.length() != 16) { + throw new EncryptException( + "The length of the key(" + + str + + ") in the file is not 16 bytes, please check the key file:" + + path); + } return str; } catch (IOException e) { throw new EncryptException("Read main encrypt key error", e);