Exemple #1
0
        private static async Task <SendEncryptBodyResp> GetReqContent_JsonEncryptSegment(WechatPayConfig payConfig,
                                                                                         Dictionary <string, string> dics)
        {
            var certRes = await WechatCertificateHelper.GetLatestCertsByConfig(payConfig);

            if (!certRes.IsSuccess())
            {
                return(certRes.ToResp <SendEncryptBodyResp>());
            }

            var cert = certRes.item;

            return(new SendEncryptBodyResp()
            {
                body = dics.ToDictionary(
                    d => d.Key,
                    d => WechatCertificateHelper.OAEPEncrypt(cert.cert_public_key, d.Value)
                    )
            });
        }