From b39b1f28e610055a53c641a8e3147345ff973906 Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期五, 07 一月 2022 13:12:38 +0800
Subject: [PATCH] 添加Mysql数据库的AES加解密方法(新增十六进制的判断方法)

---
 src/main/java/com/hx/util/mysql/aes/MysqlHexAes.java |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/hx/util/mysql/aes/MysqlHexAes.java b/src/main/java/com/hx/util/mysql/aes/MysqlHexAes.java
index c5579f3..c2a5d0a 100644
--- a/src/main/java/com/hx/util/mysql/aes/MysqlHexAes.java
+++ b/src/main/java/com/hx/util/mysql/aes/MysqlHexAes.java
@@ -38,6 +38,9 @@
      */
     public static String decryptData(String data,String aesKey,String encoding) {
         try{
+            if(data == null){
+                return null;
+            }
             if(StringUtils.isEmpty(encoding)){
                 encoding = "UTF-8";
             }
@@ -59,6 +62,9 @@
      */
     public static String encryptData(String data,String aesKey,String encoding) {
         try {
+            if(data == null){
+                return null;
+            }
             if (StringUtils.isEmpty(encoding)) {
                 encoding = "UTF-8";
             }
@@ -83,6 +89,9 @@
      * @return true or false
      */
     public static boolean isHexStrValid(String str) {
+        if(str == null){
+            return false;
+        }
         String pattern = "^[0-9A-F]+$";
         return Pattern.compile(pattern).matcher(str).matches();
     }

--
Gitblit v1.8.0