whycxzp
2021-08-10 1600146288b79049f9a2d405488d32987c889d6d
更新验证签名接口
1个文件已修改
33 ■■■■ 已修改文件
nfdw_stand/src/com/fgkj/actions/LoginAction.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
nfdw_stand/src/com/fgkj/actions/LoginAction.java
@@ -21,6 +21,7 @@
import com.fgkj.services.User_logService;
import com.fgkj.services.Vip_userService;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.json.annotations.JSON;
public class LoginAction extends ActionSupport{
@@ -265,22 +266,36 @@
    public String verify(){
        ServiceModel model = new ServiceModel();
        SignDTO signDTO = ActionUtil.getGson().fromJson(json, SignDTO.class);
        //前端将字符\替换成了huodongwei,这里再转回来
        signDTO.setInPath(signDTO.getInPath().replace("huodongwei","\\"));
        //通过uKeyId获取公钥XY
        User_inf userInf = new User_infImpl().getPublicXYByUKeyId(signDTO.getUKeyId());
        //获取之前生成的随机数
        String uKeyRandom = (String) ActionUtil.getSession().getAttribute("uKeyRandom");
        com.softkey.jsyunew3 sm2=new  com.softkey.jsyunew3();
        //userInf.setUName("xxx公司");
        boolean b = sm2.YtVerfiy(userInf.getUName(), uKeyRandom, signDTO.getPublicX(), signDTO.getPublicY(), signDTO.getSign(), signDTO.getInPath());
        boolean b = com.softkey.jsyunew3.YtVerfiy(userInf.getUName(), uKeyRandom, signDTO.getPublicX(), signDTO.getPublicY(), signDTO.getSign(), signDTO.getInPath());
        long lastError = com.softkey.jsyunew3.get_LastError();
        if(b){
            String inPath = signDTO.getInPath();
            //String userName = sm2.GetSm2UserName(inPath);
        if(b && lastError==0){
            model.setCode(1);
            //model.setData(userName);
            model.setMsg("校验成功!");
        }else{
            model.setMsg("校验错误!");
            if(lastError ==0){
                model.setMsg("校验失败");
            }else{
                String baseMsg ="校验失败,原因为:";
                switch ((int) lastError){
                    case -82 : model.setMsg(baseMsg+"写数据到加密锁储存器时错误,可能是写密码错误");break;
                    case -81 :
                    case -88 : model.setMsg(baseMsg+"输入的地址空间超出");break;
                    case -47 : model.setMsg(baseMsg+"进行读写字符串时,地址空间超出");break;
                    case -92 : model.setMsg(baseMsg+"不存在指定的加密锁");break;
                    case -93 :
                    case -94 : model.setMsg(baseMsg+"操作加密锁时错误");break;
                    case -83 : model.setMsg(baseMsg+"从加密锁读取数据时错误,可能是读密码错误");break;
                    case -46 : model.setMsg(baseMsg+"使用控件时,输入的字符不能是空字符串");break;
                    case -51 : model.setMsg(baseMsg+"打开USB文件句柄失败(iKey)");break;
                }
            }
        }
        result = ActionUtil.tojson(model);