您的位置:首页 > 其它

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());

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: