eas用户密码的加密和解密
2016-04-20 15:46
519 查看
1.加密和解密datacenter的数据库密码
加密:com.kingdee.bos.sql.KSqlUtil.encodePassword(password);
解密:
if (!password.startsWith("ksqle:"))
password = "ksqle:" + password;
String encodePassword = com.kingdee.bos.sql.KSqlUtil.decodePassword(password);
2.eas用户的加密和解密
加密使用过,可以,但解密调用会报错,原因未知
com.kingdee.eas.base.permission.app.util.PermissionUtil
com.kingdee.bos.util.CryptoTean
public static String encrypt(String userID, String password)
throws EASBizException {
return PermissionUtils.encrypt(userID, password);
}
public static String decrypt(String userNumber, String password)
throws EASBizException {
if (StringUtils.isEmpty(password)) {
return null;
}
try {
return CryptoTean.decrypt(userNumber, password);
} catch (CryptException e) {
logger.error("decrypt", e);
throw new UserException(UserException.ENCRYPT_FAIL);
}
}
public static boolean matchPassword(UserInfo userInfo, String password)
throws EASBizException {
if (StringUtils.isEmpty(password)) {
return StringUtils.isEmpty(userInfo.getPassword());
}
return encrypt(userInfo.getId().toString(), password).equals(
userInfo.getPassword());
}
加密:com.kingdee.bos.sql.KSqlUtil.encodePassword(password);
解密:
if (!password.startsWith("ksqle:"))
password = "ksqle:" + password;
String encodePassword = com.kingdee.bos.sql.KSqlUtil.decodePassword(password);
2.eas用户的加密和解密
加密使用过,可以,但解密调用会报错,原因未知
com.kingdee.eas.base.permission.app.util.PermissionUtil
com.kingdee.bos.util.CryptoTean
public static String encrypt(String userID, String password)
throws EASBizException {
return PermissionUtils.encrypt(userID, password);
}
public static String decrypt(String userNumber, String password)
throws EASBizException {
if (StringUtils.isEmpty(password)) {
return null;
}
try {
return CryptoTean.decrypt(userNumber, password);
} catch (CryptException e) {
logger.error("decrypt", e);
throw new UserException(UserException.ENCRYPT_FAIL);
}
}
public static boolean matchPassword(UserInfo userInfo, String password)
throws EASBizException {
if (StringUtils.isEmpty(password)) {
return StringUtils.isEmpty(userInfo.getPassword());
}
return encrypt(userInfo.getId().toString(), password).equals(
userInfo.getPassword());
}
相关文章推荐
- 使用struts2 urlrewrite 实现页面伪静态
- 权限管理程序
- 团队作业三
- C语言中的函数指针学习笔记
- 1、Jenkins安装
- Contextual Tab开发相关
- c3p0源码解析 六 (C3P0PooledConnectionPoolManager类)
- runtime - 方法动态添加
- Laravel 上传excel,读取并写入数据库 (实现自动建表、存记录值
- 对象传递
- transform函数转换字符串string的大小写
- 进程 vs. 线程
- 10 个迅速提升你 Git 水平的提示
- android动态设置组件LayoutParams
- 网页中开发自定义百度地图
- c++和java中的抽象
- C#Ref与Out的区别
- DeepLearning: 数据预处理2:图片resize(matlab代码)
- jsp内置对象之exception对象
- perl 操作mongodb的 连接 需要用户名和密码认证的 mongodb