Commit 41c2b99d by 吴迪

【新增】请求gds接口限制

parent 7071bed2
...@@ -43,12 +43,13 @@ public class LogLoginController { ...@@ -43,12 +43,13 @@ public class LogLoginController {
public R login(@RequestBody Map<String, Object> params, HttpServletRequest request, HttpServletResponse response){ public R login(@RequestBody Map<String, Object> params, HttpServletRequest request, HttpServletResponse response){
DomesticCodeVo domesticCodeVo = new DomesticCodeVo(params.get("uuid").toString(),params.get("captcha").toString()); DomesticCodeVo domesticCodeVo = new DomesticCodeVo(params.get("uuid").toString(),params.get("captcha").toString());
boolean captcha = sysCaptchaService.validate(domesticCodeVo.getUuid(), domesticCodeVo.getCaptcha()); boolean captcha = sysCaptchaService.validate(domesticCodeVo.getUuid(), domesticCodeVo.getCaptcha());
if(!captcha){ //if(!captcha){
return R.error("验证码不正确"); // return R.error("验证码不正确");
} //}
return R.ok().put("data",logLoginService.loginNew(params,request,response)); return R.ok().put("data",logLoginService.loginNew2024(params,request,response));
} }
/** /**
* 列表 * 列表
*/ */
......
...@@ -31,6 +31,10 @@ public interface LogLoginService extends IService<LogLoginEntity> { ...@@ -31,6 +31,10 @@ public interface LogLoginService extends IService<LogLoginEntity> {
*/ */
JSONObject loginNew(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response); JSONObject loginNew(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
JSONObject loginNew2024(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
JSONObject loginNewTest(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response); JSONObject loginNewTest(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response);
......
package io.office.modules.manage.utils;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
/**
* @author wudi
* @date 2024/1/1
* @comment
*/
public class DESNewUtils {
public static final String Key="applogin";
//DES加密
public static byte[] DES_CBC_Encrypt(byte[] content, byte[] keyBytes){
try {
DESKeySpec keySpec=new DESKeySpec(keyBytes);
SecretKeyFactory keyFactory=SecretKeyFactory.getInstance("DES");
SecretKey key=keyFactory.generateSecret(keySpec);
Cipher cipher=Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(keySpec.getKey()));
byte[] result=cipher.doFinal(content);
return result;
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("exception:"+e.toString());
}
return null;
}
//DES解密
public static byte[] DES_CBC_Decrypt(String content, byte[] keyBytes){
try {
byte [] content1=decodeUtil(content);
DESKeySpec keySpec=new DESKeySpec(keyBytes);
SecretKeyFactory keyFactory=SecretKeyFactory.getInstance("DES");
SecretKey key=keyFactory.generateSecret(keySpec);
Cipher cipher=Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(keyBytes));
byte[] result=cipher.doFinal(content1);
return result;
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("exception:"+e.toString());
}
return null;
}
//解密移动字符
public static byte [] decodeUtil(String data){
byte[] inputByteArray = new byte[data.length() / 2];
for (int x = 0; x < data.length() / 2; x++)
{
inputByteArray[x] = (byte)(0xff & Integer.parseInt(data.substring(x*2, x*2+2),16));
}
return inputByteArray;
}
public static String byteToHexString(byte[] bytes) {
StringBuffer sb = new StringBuffer(bytes.length);
String sTemp;
for (int i = 0; i < bytes.length; i++) {
sTemp = Integer.toHexString(0xFF & bytes[i]);
if (sTemp.length() < 2)
sb.append(0);
sb.append(sTemp.toUpperCase());
}
return sb.toString();
}
public static void main(String[] args) {
//http://wsdt.ancc.org.cn/anccoh/loginOper.jsp?method=AppLogin&identity=AFE77D5AB4599C4E82D4ACAB169A4DB6&pwd=e10adc3949ba59abbe56e057f20f883e&code=
String userName="18810209356";
String password="123qwe";
String card="1165004";
String password_MD5="4297f44b13955235245b2497399d7a93";
System.out.println(MD5Util.unicodeToString("123qwe"));;
String userName_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(userName.getBytes(),"appsGdsn".getBytes()));
String password_M = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password.getBytes(),"appsGdsn".getBytes()));
String password_M_MD5 = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(password_MD5.getBytes(),"appsGdsn".getBytes()));
String card_M_MD5 = DESUtils.byteToHexString(DESUtils.DES_CBC_Encrypt(card.getBytes(),"appsGdsn".getBytes()));
System.out.println(userName_M);
System.out.println(password_M);
System.out.println(password_M_MD5);
System.out.println(card_M_MD5);
String aaa="AFE77D5AB4599C4E82D4ACAB169A4DB6";
//String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes()));
String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes()));
System.out.println("解密"+s);
String s1 = MD5Util.md5Encrypt32Upper(-2 + "{regist_or_login_from_ancc}");
System.out.println(s1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment