}
/**
* DES加密<br>
*
* @author : chenssy
* @date : 2016年5月20日 下午5:39:46
*
* @param value
* 待加密字符
* @param key
* 若key为空,则使用默认key
* @return
* 加密成功返回密文,否则返回null
*/
public static String desEncrypt(String value,String key){
key = key == null ? DESUtils.KEY : key;
String result = null;
try {
if(value != null && !"".equals(value.trim())){
result = DESUtils.encrypt(value, key);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* DES解密
*
* @author : chenssy
* @date : 2016年5月20日 下午5:55:56
*
* @param value
* 待解密字符
* @param key
* 若key为空,则使用默认key
* @return
* @return
*/
public static String desDecrypt(String value,String key){
key = key == null ? DESUtils.KEY : key;
String result = null;
try {
if(value != null && !"".equals(value.trim())){
result = DESUtils.decrypt(value, key);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* AES加密
*
* @author:chenssy
* @date : 2016年5月21日 上午9:58:58
*
* @param value
* 待加密内容
* @param key
* 秘钥
* @return
*/
public static String aesEncrypt(String value,String key ){
key = key == null ? AESUtils.KEY : key;
String result = null;
try {
if(value != null && !"".equals(value.trim())){ //value is not null
result = AESUtils.encrypt(value,key);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* AES解密
*
* @author:chenssy
* @date : 2016年5月21日 上午10:02:07
*
* @param value
* 待解密内容
* @param key
* 秘钥
* @return
*/
public static String aesDecrypt(String value , String key){
key = key == null ? AESUtils.KEY : key;
String result = null;
try {
if(value != null && !"".equals(value.trim())){ //value is not null
result = AESUtils.decrypt(value,key);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。