添加Mysql数据库的AES加解密方法(新增十六进制的判断方法)
| | |
| | | */ |
| | | public static String decryptData(String data,String aesKey,String encoding) { |
| | | try{ |
| | | if(data == null){ |
| | | return null; |
| | | } |
| | | if(StringUtils.isEmpty(encoding)){ |
| | | encoding = "UTF-8"; |
| | | } |
| | |
| | | */ |
| | | public static String encryptData(String data,String aesKey,String encoding) { |
| | | try { |
| | | if(data == null){ |
| | | return null; |
| | | } |
| | | if (StringUtils.isEmpty(encoding)) { |
| | | encoding = "UTF-8"; |
| | | } |
| | |
| | | * @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(); |
| | | } |