c#
文件名 | 版本 | targetFramework | 说明 |
---|---|---|---|
GMUtilLib.dll | 1.0.0 | net45 | 国密工具库 |
BouncyCastle.Crypto.dll | 1.8.9 | net45 | 第三方加密库 |
Newtonsoft.Json.dll | 13.0.1 | net45 | 操作json的开源工具库 |
加密
using GMUtilLib
public static string encryptMsg(string chnlId, string sm4key, string prvkey, string data)
GMUtilLib.SignUtil 的成员
摘要:
对报文进行加密和签名
参数:
chnlId: 渠道id
sm4key: 渠道sm4密钥
prvkey: 渠道私钥
data: 交易报文(明文、utf8)
返回:
加密和签名的请求报文
解密
public static string decryptMsg(string sm4key, string pubKey, string data)
GMUtilLib.SignUtil 的成员
摘要:
对服务端的返回报文进行解密
参数:
sm4key: 渠道sm4密钥
pubKey: 平台公钥
data: 服务端的返回报文
返回:
解密后的输出报文