Ejemplo n.º 1
0
        private IDictionary <string, string> PrepareRequest()
        {
            var    parameters = PrepareRequestCore();
            string json       = JsonConvert.SerializeObject(parameters);
            //加密业务数据--用AES对称加密算法
            string AESKey  = AESEncryptor.GenerateAESKey();
            string strData = AESEncryptor.Encrypt(json, AESKey);
            //加密AESKey--用RSA非对称加密算法
            string strKey     = RSAEncryptor.encryptData(AESKey, XmlConfig.ReapalPublicKeyCerUrl);
            string timestamps = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            //var dic = new Dictionary<string, object>();
            //dic.Add("merchant_id", ReapalMerchantId);
            //dic.Add("data", json);
            //dic.Add("encryptkey", strKey);
            //dic.Add("timestamp", timestamps);

            var dic = new Dictionary <string, object>();

            dic.Add("merchant_id", "100000000239166");
            dic.Add("data", "{\"cert_no\":\"412722199310223521\", \"face_id\":\"201709306319733661130403840\",\"cert_name\":\"孙晨杨\"}");
            dic.Add("encryptkey", "Cii0jhBrt2plxhT9r1Tl5YiG/Q++uNmBMGXROtfE39Tj3coIYKyybIHQm42NQv5wUN8ajexoAaeykzp+lNsX5dUavKr9Ch8gxpSJpX0+C6xrSHWF3EVxJ8Y/i9DP00/D4Bw+PoWs63JTmEcDiaqIZ5IU8LvGjygpaTnZ7+Ntn2d3OM3wYAZtnX+cHwDRYC7/kJi+Ezwf4UHJj8EKqa0+y8pACqh4k2x9StjF5AhhkWB5pPWlOXFljQcXhMeQgnPgwHVX1cGVFYSADeM7IAAmVVT6BWkGf+GWPIUdeiXrFk0l1qvenyH6UWgo/SXuLm85x+toV5XD9uaiADg4XDpN+A==");
            dic.Add("timestamp", "20170930112521148");


            IDictionary <string, string> dicCollection = new SortedDictionary <string, string>();

            dicCollection.Add("merchant_id", ReapalMerchantId);
            dicCollection.Add("data", strData);
            dicCollection.Add("encryptkey", strKey);
            dicCollection.Add("timestamp", timestamps);
            //dicCollection.Add("sign", Common.Sign(dic, XmlConfig.ReapalPrivateKeyPfxUrl));
            dicCollection.Add("sign", "123456");
            dicCollection.Add("sign_type", "RSA");
            return(dicCollection);
        }