mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
更新了与MIS和VMS的通信接口(尚未测试)
This commit is contained in:
1 parent
a01fa624c0
commit
683d50c602
6 files changed
+133
-50
No files matched your search
@@ -14,6 +14,7 @@ public class MISGetValidIdentityRequest extends BaseStruct {
|
||||
public String Passwd;
|
||||
public String Phone;
|
||||
public String VerificationCode;
|
||||
public String Code;
|
||||
|
||||
public MISGetValidIdentityRequest(String identityIdentifier,
|
||||
String passwd, String phone, String verificationCode) {
|
||||
@@ -21,5 +22,6 @@ public class MISGetValidIdentityRequest extends BaseStruct {
|
||||
Passwd = passwd;
|
||||
Phone = phone;
|
||||
VerificationCode = verificationCode;
|
||||
Code="null";
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,15 @@ public class LoginWithSignRequest extends BaseStruct {
|
||||
public String Password;
|
||||
public String Certificate;
|
||||
public byte[] Signature;
|
||||
public String MachineInfo;
|
||||
|
||||
public LoginWithSignRequest(String name, String password, String certification, byte[] signature) {
|
||||
public LoginWithSignRequest(String name, String password,
|
||||
String certification, byte[] signature,
|
||||
String machineInfo) {
|
||||
Name = name;
|
||||
Password = password;
|
||||
Certificate = certification;
|
||||
Signature = signature;
|
||||
MachineInfo=machineInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package VMSConnection.Model;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description: 修改密码
|
||||
* @Version: 1.0.0
|
||||
* @Date: 16:02 2021/11/3
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ResetPassword {
|
||||
public String Name;
|
||||
public String OldPassword;
|
||||
public String NewPassword;
|
||||
public String Certificate;
|
||||
public byte[] Signature;
|
||||
public String TimeStamp;
|
||||
|
||||
public ResetPassword(String name, String oldPassword,
|
||||
String newPassword, String certificate,
|
||||
byte[] signature, String timeStamp) {
|
||||
Name = name;
|
||||
OldPassword = oldPassword;
|
||||
NewPassword = newPassword;
|
||||
Certificate = certificate;
|
||||
Signature = signature;
|
||||
TimeStamp = timeStamp;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public class VPNLoginExample {
|
||||
|
||||
// 3. 构造登录请求包
|
||||
LoginWithSignRequest loginWithSignRequest=new LoginWithSignRequest(username,
|
||||
"password",cert,loginSign);
|
||||
"password",cert,loginSign,"Android-number1");
|
||||
try {
|
||||
System.out.println("login request: "+loginWithSignRequest.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
|
||||
@@ -7,6 +7,8 @@ import MISConnection.Model.MISResetPasswordRequest;
|
||||
import VMSConnection.Model.VpnServerInfoRequest;
|
||||
import VMSConnection.Security.BC_KeyManager;
|
||||
import VMSConnection.TCPNet.Message.NetworkResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import util.JSONHelper;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
@@ -40,10 +42,13 @@ public class TestMisAPI {
|
||||
bc_keyManager.GenKeyPair();
|
||||
String pubkey=bc_keyManager.GetPubkey();
|
||||
|
||||
String username="xzwtest123";
|
||||
String phone="86"+"18186152440";
|
||||
// String username="xzwtest123";
|
||||
// String phone="86"+"18186152440";
|
||||
// String passwd="Xiaowei199876!";
|
||||
String passwd="5f46cb23a9ca184f58715278a688e7f6";
|
||||
// String passwd="5f46cb23a9ca184f58715278a688e7f6";
|
||||
String username="killer";
|
||||
String phone=""+"15239970973";
|
||||
String passwd="7cae40b17a6cf06a84c5c23c46baeffe"; // free@1898
|
||||
|
||||
// 构造验证码请求包
|
||||
MISAuthenticationRequest request=new MISAuthenticationRequest("/"+username,phone);
|
||||
@@ -57,24 +62,58 @@ public class TestMisAPI {
|
||||
// mis_api.ip="192.168.3.15";
|
||||
mis_api.ip="121.15.171.89"; // gdcni17
|
||||
System.out.println(mis_api.ip+mis_api.port+mis_api.sslPort);
|
||||
// 手机验证码
|
||||
NetworkResponse networkResponse=mis_api.getSMSMessage(request);
|
||||
try {
|
||||
System.out.println("获取验证码应答: "+networkResponse.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
boolean _SMSCode = false;
|
||||
boolean _GetIdentity = false;
|
||||
boolean _ChangePasswd = true;
|
||||
String smscode="484059";
|
||||
String encPri="hO14CELxvyoGqQQLVFWkMWP+AnwQx/86YdGOUJFy+HF8QUd" +
|
||||
"V/O8BgK+0gGQsZMw9mdafeyHukJ/FsevcOMc7XLqBbQ5bmHAAvPnR" +
|
||||
"+Isr6eRbBcpaMhKRt4fiE31q21HNymyraXPfRQ1vSyWBL1NGMhNwia" +
|
||||
"J/FVQETw9Itvbqavi3OQQ7wDOPxUq+OEZThGEf85GdmPqCeQdt8l7" +
|
||||
"+ZR4Y5B44bKFDpkaNZzuSIKj84rOaoEktwxDhMZ1FQoP4Y1mQ3qSY8" +
|
||||
"H0ZQUMUbKBp5AwiU0p63MCyiYQKwd0y7MLeI5jBPurkux70irELibX" +
|
||||
"HQBXjCkC97SeeuseyA5Jjao8vfM9L7prtgidnI7IOP+cWnakxDtup1" +
|
||||
"jfcsdhG7wzEDy5XLMg6cS1jLEURaa2NvDFWWL86beiKg69/N+o71kIC" +
|
||||
"+XTDd+c5UQANBXk2FQ6yB9LDS4BmHSkuWl9g9LCXDIHzPChdqwf1T63" +
|
||||
"8lNVzVsx6Qd7wh4h9LZWE8sqLf1OtFje2LHiocB1H9iT5PER4VQIOsm" +
|
||||
"SRGGeodPvAaWlAICMaQfXeQPDzjybUHaDTIME1sirEwAEZVrmNm/dnSv" +
|
||||
"klAk6Kw5UPLxo339zFklAgTAlsNyXgRN05/VCPw4y7GyPfCYH8H5w3NS" +
|
||||
"gZuspzgiGnjC6bwrb8hywtgOnbkcYp84Ufdf/Dw2ifYNMXqD+GEDfTIN" +
|
||||
"NMVf8k3DT5FqwiketPJrK82wRbKXFEvS9duK/p2BPcmBNKtG4Wysr/rz" +
|
||||
"pr3kkB4u62cmxbtTtTkPylx2Dy/QoNijYY0pwqI8m9dtdE4g9jr0ZJuM" +
|
||||
"E+lfpG6GjtwFjpo/NY6qr0z/Y1JipGFKEn9dkRt1wpTCstVfDauF8AXr5" +
|
||||
"QwdwFTCH6NOczzCzEa2GUW1N1cJAqjDOAFMXgCZq6DD/VtNZb4wrWNUsP/" +
|
||||
"I+KVStGSKPynczvh9TrTdjdslDKaxqoXmef1UdQ0RtSgEyByTT+Fp56jU" +
|
||||
"2SnPtmkVFIXeJafnzLHBSWkMegxhl3TuymbeKxrJsY9I1arw0rNCz2Hac" +
|
||||
"MEutmLGMnfutR+lg1FpHfcuwgNlphpfQawrTcaKAxr/TXpkgCbj4hwt69s" +
|
||||
"2zwDbBQDEc/WrV39onYLB45VU9dHHIixUSzinZLLCoNyED1H5YYl24BUGoa" +
|
||||
"YkOUPzFCBmQ6jSV3+ixMPPrhAcRkdZkeLAD2FxDUbICJP0dr/qXTEG8Kb2vR" +
|
||||
"z+w4VZewV0PmLOfp+2rNFIuFZ3p4nTJ0iMpEWzJCDY8YKteR6q91wgN3zUe5" +
|
||||
"k5wA5P1FUg2ud0AUiRndBa0c80nfXVu/tEkgc2VHnxCHR70Q+NwQop8mSsajB" +
|
||||
"tmQg0NDwW5CtX0Sx2vGcybp4N6O4ZavJlagrGxId8H4aAI3OOMsg0QqODcF5" +
|
||||
"9+yo+ut9u1EskdqQeVMAZMszKFtkAc2I2tNDNZe76iRRpnQnqtQI2ydyC4x28Ntgja1b8Td";
|
||||
|
||||
// // 手机验证码
|
||||
if(_SMSCode){
|
||||
NetworkResponse networkResponse=mis_api.getSMSMessage(request);
|
||||
try {
|
||||
System.out.println("获取验证码应答: "+networkResponse.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(networkResponse.Code);
|
||||
}
|
||||
System.out.println(networkResponse.Code);
|
||||
|
||||
//// // 注册
|
||||
MISRegisterRequest registerRequest=new MISRegisterRequest("/"+username,
|
||||
pubkey,passwd,"hello,iamtheprikeyencrypted",
|
||||
phone,"640432");
|
||||
try {
|
||||
System.out.println("register request: "+registerRequest.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// MISRegisterRequest registerRequest=new MISRegisterRequest("/"+username,
|
||||
// pubkey,passwd,"hello,iamtheprikeyencrypted",
|
||||
// phone,"640432");
|
||||
// try {
|
||||
// System.out.println("register request: "+registerRequest.toJson());
|
||||
// } catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// // 获取注册应答
|
||||
// NetworkResponse networkResponse3=mis_api.registerMIS(registerRequest);
|
||||
@@ -85,37 +124,47 @@ public class TestMisAPI {
|
||||
// }
|
||||
// System.out.println(networkResponse3.Code);
|
||||
|
||||
// // 获取已注册的身份信息
|
||||
// MISGetValidIdentityRequest getValidIdentityRequest=new MISGetValidIdentityRequest("/"+username,
|
||||
// passwd,phone,"454308");
|
||||
// try {
|
||||
// System.out.println("getidentity request: "+getValidIdentityRequest.toJson());
|
||||
// } catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// NetworkResponse networkResponse3=mis_api.getValidIdentityMIS(getValidIdentityRequest);
|
||||
// try {
|
||||
// System.out.println("获取身份应答: "+networkResponse3.toJson());
|
||||
// } catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// System.out.println(networkResponse3.Code);
|
||||
// 获取已注册的身份信息
|
||||
if(_GetIdentity){
|
||||
MISGetValidIdentityRequest getValidIdentityRequest=new MISGetValidIdentityRequest(
|
||||
"/"+username, passwd,phone,smscode);
|
||||
try {
|
||||
System.out.println("getidentity request: "+getValidIdentityRequest.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
NetworkResponse networkResponse3=mis_api.getValidIdentityMIS(getValidIdentityRequest);
|
||||
try {
|
||||
System.out.println("获取身份应答: "+networkResponse3.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(networkResponse3.Code);
|
||||
// 将data字段取出来打印
|
||||
System.out.println(new String(networkResponse3.Data));
|
||||
// 将data字段转json,然后取身份 (PrikeyEncrypted)
|
||||
JSONObject jsonObject=JSONObject.parseObject(new String(networkResponse3.Data));
|
||||
String res=jsonObject.getString("PrikeyEncrypted");
|
||||
System.out.println("加密身份: "+res);
|
||||
}
|
||||
|
||||
// 更改密码及私钥
|
||||
MISResetPasswordRequest rese=new MISResetPasswordRequest("/"+username,
|
||||
passwd,"new12345",
|
||||
"hello,iamtheprikeyencrypted.iamnew.",phone,"321521");
|
||||
try {
|
||||
System.out.println("reset request: "+rese.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
if(_ChangePasswd){
|
||||
MISResetPasswordRequest rese=new MISResetPasswordRequest("/"+username,
|
||||
passwd,passwd,
|
||||
encPri,phone,smscode);
|
||||
try {
|
||||
System.out.println("reset request: "+rese.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
NetworkResponse networkResponse3=mis_api.resetPasswordMIS(rese);
|
||||
try {
|
||||
System.out.println("更改密码及密钥应答: "+networkResponse3.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(networkResponse3.Code);
|
||||
}
|
||||
NetworkResponse networkResponse3=mis_api.resetPasswordMIS(rese);
|
||||
try {
|
||||
System.out.println("更改密码及密钥应答: "+networkResponse3.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(networkResponse3.Code);
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class TestAPI {
|
||||
// LoginWithSignRequest loginWithSignRequest=new LoginWithSignRequest(username,
|
||||
// "password",new String(networkResponse.Data),sig);
|
||||
LoginWithSignRequest loginWithSignRequest=new LoginWithSignRequest(username,
|
||||
"password","fucked cert",sig);
|
||||
"password","fucked cert",sig,"Android-GuessMe");
|
||||
|
||||
try {
|
||||
System.out.println("login request: "+loginWithSignRequest.toJson());
|
||||
|
||||
Reference in new issue
Block a user