确认参数

This commit is contained in:
cheney
2022-06-21 18:40:51 +08:00
parent 3cd9e78990
commit 080c705d72
2 changed files with 22 additions and 6 deletions
@@ -2561,10 +2561,12 @@ public class SydApi4j implements SydApi {
// 生成会话密钥
ret = SM2GenSessionKey(pk);
String ciperKey = new String( (byte[]) ret.get(SydApi.RET_CIPHER_KEY));
String sessionKeyByLMK = new String( (byte[]) ret.get(SydApi.RET_SESSION_KEY ));
String ciperKey = ret.get(SydApi.RET_CIPHER_KEY).toString();
String sessionKeyByLMK = (String) ret.get(SydApi.RET_SESSION_KEY );
ret.put(SydApi.RET_SESSION_KEY , sessionKeyByLMK.getBytes() );
println("ciperKey=" + ciperKey);
println("sessionKeyByLMK=" + sessionKeyByLMK);
// 加密数据
byte[] iv = new byte[32];
@@ -2573,7 +2575,7 @@ public class SydApi4j implements SydApi {
byte[] enData = (byte[]) retWrap.get("msg_all");
// 组织格式
ContentInfo cms = genCMSEnvelopedData(Util.hexString2Bytes(ciperKey), enData,
ContentInfo cms = genCMSEnvelopedData( Util.hexString2Bytes(ciperKey), enData,
x509.getSerialNumber().toString(16) ,
dnToMap(issuser.getName() )
);
@@ -5142,14 +5144,14 @@ public class SydApi4j implements SydApi {
}
RetWrap rw = new RetWrap();
rw.put(SydApi.RET_CIPHER_KEY,
((PacketSection) ret.get("key")).getBytes()
Util.bytes2HexString( ((PacketSection) ret.get("key")).getBytes() )
);
rw.put(SydApi.RET_SESSION_KEY, (((PacketSection) ret.get("lmkHead")).getString() +
((PacketSection) ret.get("lmk")).getString()).getBytes()
((PacketSection) ret.get("lmk")).getString())
);
rw.put(SydApi.RET_KCV, ((PacketSection) ret.get("keyCheck")).getBytes());
rw.put(SydApi.RET_KCV, ((PacketSection) ret.get("keyCheck")).getString());
return rw;
}