mirror of
https://gitee.com/willfree/min-vpn-non-core.git
synced 2026-10-05 01:15:48 +08:00
1. 解决了go中的转json会自动将byte[]转为base64的问题;2. 去min-lib-dev化,将用到的东西全部迁过来。
This commit is contained in:
1 parent
3e96c8dc0a
commit
e01e38b817
19 files changed
+1217
-17
No files matched your search
@@ -3,6 +3,7 @@ package TCPNet;
|
||||
import Security.BC_KeyManager;
|
||||
import TCPNet.request.BaseRequest;
|
||||
import TCPNet.response.BaseResponse;
|
||||
import Utils.Base64Helper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.parser.JSONToken;
|
||||
import org.bouncycastle.crypto.InvalidCipherTextException;
|
||||
@@ -59,7 +60,10 @@ class SSL_Message extends BaseRequest{
|
||||
Field thisf = thiscls.getDeclaredField(f.getName());
|
||||
thisf.setAccessible(true);
|
||||
if(thisf.getType()==(byte[].class)){
|
||||
thisf.set(this, ((String)(f.get(newObj))).getBytes(StandardCharsets.UTF_8));
|
||||
// byte[]需要解码base64
|
||||
String base64S=(String)(f.get(newObj));
|
||||
byte[] decodeBytes= Base64Helper.BlockChain_Base64Decode_GoLanUn(base64S);
|
||||
thisf.set(this, decodeBytes);
|
||||
}else {
|
||||
thisf.set(this, f.get(newObj));
|
||||
}
|
||||
@@ -154,15 +158,15 @@ public class SSL {
|
||||
System.out.println("secretkey: "+secretKey);
|
||||
// 用对称密钥解密应答信息
|
||||
byte[] decRes;
|
||||
// try {
|
||||
try {
|
||||
// todo:这里sm4有问题
|
||||
decRes="{\"Code\":200}".getBytes(StandardCharsets.UTF_8);
|
||||
// decRes=BC_KeyManager.SM4Decrypt(secretKey,resData);
|
||||
// } catch (IllegalBlockSizeException | InvalidKeyException | NoSuchProviderException
|
||||
// | NoSuchAlgorithmException | BadPaddingException | NoSuchPaddingException e) {
|
||||
// e.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// decRes="{\"Code\":200}".getBytes(StandardCharsets.UTF_8);
|
||||
decRes=BC_KeyManager.SM4Decrypt(secretKey,resData);
|
||||
} catch (IllegalBlockSizeException | InvalidKeyException | NoSuchProviderException
|
||||
| NoSuchAlgorithmException | BadPaddingException | NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
// 将解密信息转为Java对象
|
||||
SSL_RespMessage resp=new SSL_RespMessage();
|
||||
|
||||
Reference in new issue
Block a user