mirror of
https://gitee.com/willfree/min-vpn-client_v2.git
synced 2026-10-04 19:42:00 +08:00
vpn connection 测试通过,可正常握手,可访问filegator并正确下载文件
This commit is contained in:
1 parent
90812c8e1a
commit
0c4a1bb7ec
2 files changed
+22
No files matched your search
@@ -342,8 +342,12 @@ public class MINVpnConnection implements Runnable{
|
||||
byte[] decrpytedIPPackage = new byte[buf2.position()];
|
||||
System.arraycopy(buf2.array(), 0, decrpytedIPPackage, 0, buf2.position());
|
||||
ByteBuffer buf3 = ByteBuffer.allocate(5000);
|
||||
System.out.println("要解密啦,要解密的包是:"+ Arrays.toString(decrpytedIPPackage));
|
||||
System.out.println("要解密啦,要解密的包长度是:"+decrpytedIPPackage.length);
|
||||
buf3.put(Objects.requireNonNull(AESHelperForConnection.decryptWithAES(mSharedSecretString, decrpytedIPPackage)));
|
||||
// buf3.put(Objects.requireNonNull(SM4HelperForConnection.decryptWithSM4(realSecret, decrpytedIPPackage)));
|
||||
System.out.println("解密结果:"+ Arrays.toString(buf3.array()));
|
||||
System.out.println("解密结果-len:"+ buf3.position());
|
||||
int decryptedDataLen = buf3.position();
|
||||
byte firstByte = buf3.get(0);
|
||||
if (firstByte == 0) {
|
||||
|
||||
@@ -108,6 +108,10 @@ public class AESHelperForConnection {
|
||||
|
||||
// AES without base64
|
||||
public static byte[] decryptWithAES(String key, final byte[] message) {
|
||||
// System.out.println("key: "+key);
|
||||
// System.out.println("aes解密: "+ Arrays.toString(message));
|
||||
// System.out.println("aes解密: "+message.length);
|
||||
// System.out.println("aes解密: "+toPos(message));
|
||||
try {
|
||||
// Use md5 value as the real key
|
||||
byte[] b = key.getBytes();
|
||||
@@ -129,4 +133,18 @@ public class AESHelperForConnection {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 输出byte[]
|
||||
private static String toPos(byte[] a){
|
||||
String res="[";
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if(a[i]<0){
|
||||
res+=a[i]+256+", ";
|
||||
}else {
|
||||
res+=a[i]+", ";
|
||||
}
|
||||
}
|
||||
res+="]";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user