瀏覽代碼

修改bug

zhoufan 8 年之前
父節點
當前提交
9e22c5050e

+ 1 - 1
ShopMobile/Mobile/View/OrderDatail.html

@@ -22,7 +22,7 @@
22 22
             modelData: {},
23 23
             gopay: function () {
24 24
                 common.confirm("确定要支付此订单吗?", function () {
25
-                    window.location.href = "/view/pay/pay_zfb.aspx?orderid=" + model.modelData.OrderID;
25
+                    window.location.href = "/Mobile/view/pay/pay_zfb.aspx?orderid=" + model.modelData.OrderID;
26 26
 
27 27
                     //var date = common.getnowdate("yyyyMMddHHmmss");
28 28
                     //var strdata = { action: "order_payorder", "orderid": model.modelData.OrderID, timestamp: date };

+ 4 - 7
ShopMobile/Mobile/View/Pay/Alipay/AlipayConfig.cs

@@ -28,11 +28,8 @@ namespace Com.Alipay
28 28
         // 收款支付宝账号,以2088开头由16位纯数字组成的字符串,一般情况下收款账号就是签约账号
29 29
         public static string seller_id = partner;
30 30
 
31
-        //商户的私钥,原始格式,RSA公私钥生成:https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.nBDxfy&treeId=58&articleId=103242&docType=1
32
-        public static string private_key = "";
33
-
34
-        //支付宝的公钥,查看地址:https://b.alipay.com/order/pidAndKey.htm 
35
-        public static string alipay_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";
31
+        // MD5密钥,安全检验码,由数字和字母组成的32位字符串,查看地址:https://b.alipay.com/order/pidAndKey.htm
32
+        public static string key = "";
36 33
 
37 34
         // 服务器异步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
38 35
         public static string notify_url = "http://商户网关地址/alipay.wap.create.direct.pay.by.user-CSHARP-UTF-8/notify_url.aspx";
@@ -41,10 +38,10 @@ namespace Com.Alipay
41 38
         public static string return_url = "http://商户网关地址/alipay.wap.create.direct.pay.by.user-CSHARP-UTF-8/return_url.aspx";
42 39
 
43 40
         // 签名方式
44
-        public static string sign_type = "RSA";
41
+        public static string sign_type = "MD5";
45 42
 
46 43
         // 调试用,创建TXT日志文件夹路径,见AlipayCore.cs类中的LogResult(string sWord)打印方法。
47
-        public static string log_path = HttpRuntime.AppDomainAppPath.ToString() + "log/";
44
+        public static string log_path = HttpRuntime.AppDomainAppPath.ToString() + "log\\";
48 45
 
49 46
         // 字符编码格式 目前支持utf-8
50 47
         public static string input_charset = "utf-8";

+ 4 - 4
ShopMobile/Mobile/View/Pay/Alipay/AlipayNotify.cs

@@ -24,7 +24,7 @@ namespace Com.Alipay
24 24
     {
25 25
         #region 字段
26 26
         private string _partner = "";               //合作身份者ID
27
-        private string alipay_public_key = "";            //支付宝的公
27
+        private string _key = "";                   //商户的私
28 28
         private string _input_charset = "";         //编码格式
29 29
         private string _sign_type = "";             //签名方式
30 30
 
@@ -43,7 +43,7 @@ namespace Com.Alipay
43 43
         {
44 44
             //初始化基础配置信息
45 45
             _partner = Config.partner.Trim();
46
-            alipay_public_key = Config.alipay_public_key.Trim();
46
+            _key = Config.key.Trim();
47 47
             _input_charset = Config.input_charset.Trim().ToLower();
48 48
             _sign_type = Config.sign_type.Trim().ToUpper();
49 49
         }
@@ -139,8 +139,8 @@ namespace Com.Alipay
139 139
             {
140 140
                 switch (_sign_type)
141 141
                 {
142
-                    case "RSA":
143
-                        isSgin = RSAFromPkcs8.verify(preSignStr, sign, alipay_public_key, _input_charset);
142
+                    case "MD5":
143
+                        isSgin = AlipayMD5.Verify(preSignStr, sign, _key, _input_charset);
144 144
                         break;
145 145
                     default:
146 146
                         break;

+ 4 - 4
ShopMobile/Mobile/View/Pay/Alipay/AlipaySubmit.cs

@@ -24,7 +24,7 @@ namespace Com.Alipay
24 24
         //支付宝网关地址(新)
25 25
         private static string GATEWAY_NEW = "https://mapi.alipay.com/gateway.do?";
26 26
         //商户的私钥
27
-        private static string _private_key = "";
27
+        private static string _key = "";
28 28
         //编码格式
29 29
         private static string _input_charset = "";
30 30
         //签名方式
@@ -33,7 +33,7 @@ namespace Com.Alipay
33 33
 
34 34
         static Submit()
35 35
         {
36
-            _private_key = Config.private_key;
36
+            _key = Config.key.Trim();
37 37
             _input_charset = Config.input_charset.Trim().ToLower();
38 38
             _sign_type = Config.sign_type.Trim().ToUpper();
39 39
         }
@@ -52,8 +52,8 @@ namespace Com.Alipay
52 52
             string mysign = "";
53 53
             switch (_sign_type)
54 54
             {
55
-                case "RSA":
56
-                    mysign = RSAFromPkcs8.sign(prestr, _private_key, _input_charset);
55
+                case "MD5":
56
+                    mysign = AlipayMD5.Sign(prestr, _key, _input_charset);
57 57
                     break;
58 58
                 default:
59 59
                     mysign = "";

+ 71 - 0
ShopMobile/Mobile/View/Pay/Alipay/MD5.cs

@@ -0,0 +1,71 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+using System.IO;
5
+using System.Security.Cryptography;
6
+
7
+namespace Com.Alipay
8
+{
9
+    /// <summary>
10
+    /// 类名:MD5
11
+    /// 功能:MD5加密
12
+    /// 版本:3.3
13
+    /// 修改日期:2012-07-05
14
+    /// 说明:
15
+    /// 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
16
+    /// 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
17
+    /// </summary>
18
+    public sealed class AlipayMD5
19
+    {
20
+        public AlipayMD5()
21
+        {
22
+            //
23
+            // TODO: 在此处添加构造函数逻辑
24
+            //
25
+        }
26
+
27
+        /// <summary>
28
+        /// 签名字符串
29
+        /// </summary>
30
+        /// <param name="prestr">需要签名的字符串</param>
31
+        /// <param name="key">密钥</param>
32
+        /// <param name="_input_charset">编码格式</param>
33
+        /// <returns>签名结果</returns>
34
+        public static string Sign(string prestr, string key, string _input_charset)
35
+        {
36
+            StringBuilder sb = new StringBuilder(32);
37
+
38
+            prestr = prestr + key;
39
+
40
+            MD5 md5 = new MD5CryptoServiceProvider();
41
+            byte[] t = md5.ComputeHash(Encoding.GetEncoding(_input_charset).GetBytes(prestr));
42
+            for (int i = 0; i < t.Length; i++)
43
+            {
44
+                sb.Append(t[i].ToString("x").PadLeft(2, '0'));
45
+            }
46
+
47
+            return sb.ToString();
48
+        }
49
+
50
+        /// <summary>
51
+        /// 验证签名
52
+        /// </summary>
53
+        /// <param name="prestr">需要签名的字符串</param>
54
+        /// <param name="sign">签名结果</param>
55
+        /// <param name="key">密钥</param>
56
+        /// <param name="_input_charset">编码格式</param>
57
+        /// <returns>验证结果</returns>
58
+        public static bool Verify(string prestr, string sign, string key, string _input_charset)
59
+        {
60
+            string mysign = Sign(prestr, key, _input_charset);
61
+            if (mysign == sign)
62
+            {
63
+                return true;
64
+            }
65
+            else
66
+            {
67
+                return false;
68
+            }
69
+        }
70
+    }
71
+}

+ 0 - 452
ShopMobile/Mobile/View/Pay/Alipay/RSA.cs

@@ -1,452 +0,0 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Text;
4
-using System.IO;
5
-using System.Security.Cryptography;
6
-
7
-namespace Com.Alipay
8
-{
9
-    /// <summary>
10
-    /// 类名:RSAFromPkcs8
11
-    /// 功能:RSA解密、签名、验签
12
-    /// 详细:该类对Java生成的密钥进行解密和签名以及验签专用类,不需要修改
13
-    /// 版本:2.0
14
-    /// 修改日期:2011-05-10
15
-    /// 说明:
16
-    /// 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
17
-    /// 该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
18
-    /// </summary>
19
-    public sealed class RSAFromPkcs8
20
-    {
21
-        /// <summary>
22
-        /// 签名
23
-        /// </summary>
24
-        /// <param name="content">需要签名的内容</param>
25
-        /// <param name="privateKey">私钥</param>
26
-        /// <param name="input_charset">编码格式</param>
27
-        /// <returns></returns>
28
-        public static string sign(string content, string privateKey, string input_charset)
29
-        {
30
-            return RSASignCharSet(content, privateKey, input_charset);
31
-        }
32
-
33
-        public static string RSASignCharSet(string data, string privateKey, string charset)
34
-        {
35
-            RSACryptoServiceProvider rsaCsp = LoadCertificateString(privateKey);
36
-            byte[] dataBytes = null;
37
-            if (string.IsNullOrEmpty(charset))
38
-            {
39
-                dataBytes = Encoding.UTF8.GetBytes(data);
40
-            }
41
-            else
42
-            {
43
-                dataBytes = Encoding.GetEncoding(charset).GetBytes(data);
44
-            }
45
-
46
-            byte[] signatureBytes = rsaCsp.SignData(dataBytes, "SHA1");
47
-
48
-            return Convert.ToBase64String(signatureBytes);
49
-        }
50
-
51
-        private static RSACryptoServiceProvider LoadCertificateString(string strKey)
52
-        {
53
-            byte[] data = null;
54
-            //读取带
55
-            //ata = Encoding.Default.GetBytes(strKey);
56
-            data = Convert.FromBase64String(strKey);
57
-            //data = GetPem("RSA PRIVATE KEY", data);
58
-            try
59
-            {
60
-                RSACryptoServiceProvider rsa = DecodeRSAPrivateKey(data);
61
-                return rsa;
62
-            }
63
-            catch (Exception ex)
64
-            {
65
-                //    throw new AopException("EncryptContent = woshihaoren,zheshiyigeceshi,wanerde", ex);
66
-            }
67
-            return null;
68
-        }
69
-
70
-        private static RSACryptoServiceProvider LoadCertificateFile(string filename)
71
-        {
72
-            using (System.IO.FileStream fs = System.IO.File.OpenRead(filename))
73
-            {
74
-                byte[] data = new byte[fs.Length];
75
-                byte[] res = null;
76
-                fs.Read(data, 0, data.Length);
77
-                if (data[0] != 0x30)
78
-                {
79
-                    res = GetPem("RSA PRIVATE KEY", data);
80
-                }
81
-                try
82
-                {
83
-                    RSACryptoServiceProvider rsa = DecodeRSAPrivateKey(res);
84
-                    return rsa;
85
-                }
86
-                catch (Exception ex)
87
-                {
88
-                }
89
-                return null;
90
-            }
91
-        }
92
-
93
-        private static byte[] GetPem(string type, byte[] data)
94
-        {
95
-            string pem = Encoding.UTF8.GetString(data);
96
-            string header = String.Format("-----BEGIN {0}-----\\n", type);
97
-            string footer = String.Format("-----END {0}-----", type);
98
-            int start = pem.IndexOf(header) + header.Length;
99
-            int end = pem.IndexOf(footer, start);
100
-            string base64 = pem.Substring(start, (end - start));
101
-
102
-            return Convert.FromBase64String(base64);
103
-        }
104
-
105
-
106
-
107
-        /// <summary>
108
-        /// 验证签名
109
-        /// </summary>
110
-        /// <param name="content">需要验证的内容</param>
111
-        /// <param name="signedString">签名结果</param>
112
-        /// <param name="publicKey">公钥</param>
113
-        /// <param name="input_charset">编码格式</param>
114
-        /// <returns></returns>
115
-        public static bool verify(string content, string signedString, string publicKey, string input_charset)
116
-        {
117
-            bool result = false;
118
-
119
-            Encoding code = Encoding.GetEncoding(input_charset);
120
-            byte[] Data = code.GetBytes(content);
121
-            byte[] data = Convert.FromBase64String(signedString);
122
-            RSAParameters paraPub = ConvertFromPublicKey(publicKey);
123
-            RSACryptoServiceProvider rsaPub = new RSACryptoServiceProvider();
124
-            rsaPub.ImportParameters(paraPub);
125
-
126
-            SHA1 sh = new SHA1CryptoServiceProvider();
127
-            result = rsaPub.VerifyData(Data, sh, data);
128
-            return result;
129
-        }
130
-
131
-        /// <summary>
132
-        /// 用RSA解密
133
-        /// </summary>
134
-        /// <param name="resData">待解密字符串</param>
135
-        /// <param name="privateKey">私钥</param>
136
-        /// <param name="input_charset">编码格式</param>
137
-        /// <returns>解密结果</returns>
138
-        public static string decryptData(string resData, string privateKey, string input_charset)
139
-        {
140
-            byte[] DataToDecrypt = Convert.FromBase64String(resData);
141
-            List<byte> result = new List<byte>();
142
-
143
-            for (int j = 0; j < DataToDecrypt.Length / 128; j++)
144
-            {
145
-                byte[] buf = new byte[128];
146
-                for (int i = 0; i < 128; i++)
147
-                {
148
-                    buf[i] = DataToDecrypt[i + 128 * j];
149
-                }
150
-                result.AddRange(decrypt(buf, privateKey, input_charset));
151
-            }
152
-            byte[] source = result.ToArray();
153
-            char[] asciiChars = new char[Encoding.GetEncoding(input_charset).GetCharCount(source, 0, source.Length)];
154
-            Encoding.GetEncoding(input_charset).GetChars(source, 0, source.Length, asciiChars, 0);
155
-            return new string(asciiChars);
156
-        }
157
-
158
-        private static byte[] decrypt(byte[] data, string privateKey, string input_charset)
159
-        {
160
-            RSACryptoServiceProvider rsa = DecodePemPrivateKey(privateKey);
161
-            SHA1 sh = new SHA1CryptoServiceProvider();
162
-            return rsa.Decrypt(data, false);
163
-        }
164
-
165
-        /// <summary>
166
-        /// 解析java生成的pem文件私钥
167
-        /// </summary>
168
-        /// <param name="pemstr"></param>
169
-        /// <returns></returns>
170
-        private static RSACryptoServiceProvider DecodePemPrivateKey(String pemstr)
171
-        {
172
-            byte[] pkcs8privatekey;
173
-            pkcs8privatekey = Convert.FromBase64String(pemstr);
174
-            if (pkcs8privatekey != null)
175
-            {
176
-
177
-                RSACryptoServiceProvider rsa = DecodePrivateKeyInfo(pkcs8privatekey);
178
-                return rsa;
179
-            }
180
-            else
181
-                return null;
182
-        }
183
-
184
-        private static RSACryptoServiceProvider DecodePrivateKeyInfo(byte[] pkcs8)
185
-        {
186
-
187
-            byte[] SeqOID = { 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 };
188
-            byte[] seq = new byte[15];
189
-
190
-            MemoryStream mem = new MemoryStream(pkcs8);
191
-            int lenstream = (int)mem.Length;
192
-            BinaryReader binr = new BinaryReader(mem);    //wrap Memory Stream with BinaryReader for easy reading
193
-            byte bt = 0;
194
-            ushort twobytes = 0;
195
-
196
-            try
197
-            {
198
-
199
-                twobytes = binr.ReadUInt16();
200
-                if (twobytes == 0x8130)	//data read as little endian order (actual data order for Sequence is 30 81)
201
-                    binr.ReadByte();	//advance 1 byte
202
-                else if (twobytes == 0x8230)
203
-                    binr.ReadInt16();	//advance 2 bytes
204
-                else
205
-                    return null;
206
-
207
-
208
-                bt = binr.ReadByte();
209
-                if (bt != 0x02)
210
-                    return null;
211
-
212
-                twobytes = binr.ReadUInt16();
213
-
214
-                if (twobytes != 0x0001)
215
-                    return null;
216
-
217
-                seq = binr.ReadBytes(15);		//read the Sequence OID
218
-                if (!CompareBytearrays(seq, SeqOID))	//make sure Sequence for OID is correct
219
-                    return null;
220
-
221
-                bt = binr.ReadByte();
222
-                if (bt != 0x04)	//expect an Octet string 
223
-                    return null;
224
-
225
-                bt = binr.ReadByte();		//read next byte, or next 2 bytes is  0x81 or 0x82; otherwise bt is the byte count
226
-                if (bt == 0x81)
227
-                    binr.ReadByte();
228
-                else
229
-                    if (bt == 0x82)
230
-                    binr.ReadUInt16();
231
-                //------ at this stage, the remaining sequence should be the RSA private key
232
-
233
-                byte[] rsaprivkey = binr.ReadBytes((int)(lenstream - mem.Position));
234
-                RSACryptoServiceProvider rsacsp = DecodeRSAPrivateKey(rsaprivkey);
235
-                return rsacsp;
236
-            }
237
-
238
-            catch (Exception)
239
-            {
240
-                return null;
241
-            }
242
-
243
-            finally { binr.Close(); }
244
-
245
-        }
246
-
247
-
248
-        private static bool CompareBytearrays(byte[] a, byte[] b)
249
-        {
250
-            if (a.Length != b.Length)
251
-                return false;
252
-            int i = 0;
253
-            foreach (byte c in a)
254
-            {
255
-                if (c != b[i])
256
-                    return false;
257
-                i++;
258
-            }
259
-            return true;
260
-        }
261
-
262
-        private static RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey)
263
-        {
264
-            byte[] MODULUS, E, D, P, Q, DP, DQ, IQ;
265
-
266
-            // ---------  Set up stream to decode the asn.1 encoded RSA private key  ------
267
-            MemoryStream mem = new MemoryStream(privkey);
268
-            BinaryReader binr = new BinaryReader(mem);    //wrap Memory Stream with BinaryReader for easy reading
269
-            byte bt = 0;
270
-            ushort twobytes = 0;
271
-            int elems = 0;
272
-            try
273
-            {
274
-                twobytes = binr.ReadUInt16();
275
-                if (twobytes == 0x8130)	//data read as little endian order (actual data order for Sequence is 30 81)
276
-                    binr.ReadByte();	//advance 1 byte
277
-                else if (twobytes == 0x8230)
278
-                    binr.ReadInt16();	//advance 2 bytes
279
-                else
280
-                    return null;
281
-
282
-                twobytes = binr.ReadUInt16();
283
-                if (twobytes != 0x0102)	//version number
284
-                    return null;
285
-                bt = binr.ReadByte();
286
-                if (bt != 0x00)
287
-                    return null;
288
-
289
-
290
-                //------  all private key components are Integer sequences ----
291
-                elems = GetIntegerSize(binr);
292
-                MODULUS = binr.ReadBytes(elems);
293
-
294
-                elems = GetIntegerSize(binr);
295
-                E = binr.ReadBytes(elems);
296
-
297
-                elems = GetIntegerSize(binr);
298
-                D = binr.ReadBytes(elems);
299
-
300
-                elems = GetIntegerSize(binr);
301
-                P = binr.ReadBytes(elems);
302
-
303
-                elems = GetIntegerSize(binr);
304
-                Q = binr.ReadBytes(elems);
305
-
306
-                elems = GetIntegerSize(binr);
307
-                DP = binr.ReadBytes(elems);
308
-
309
-                elems = GetIntegerSize(binr);
310
-                DQ = binr.ReadBytes(elems);
311
-
312
-                elems = GetIntegerSize(binr);
313
-                IQ = binr.ReadBytes(elems);
314
-
315
-                // ------- create RSACryptoServiceProvider instance and initialize with public key -----
316
-                RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
317
-                RSAParameters RSAparams = new RSAParameters();
318
-                RSAparams.Modulus = MODULUS;
319
-                RSAparams.Exponent = E;
320
-                RSAparams.D = D;
321
-                RSAparams.P = P;
322
-                RSAparams.Q = Q;
323
-                RSAparams.DP = DP;
324
-                RSAparams.DQ = DQ;
325
-                RSAparams.InverseQ = IQ;
326
-                RSA.ImportParameters(RSAparams);
327
-                return RSA;
328
-            }
329
-            catch (Exception)
330
-            {
331
-                return null;
332
-            }
333
-            finally { binr.Close(); }
334
-        }
335
-
336
-        private static int GetIntegerSize(BinaryReader binr)
337
-        {
338
-            byte bt = 0;
339
-            byte lowbyte = 0x00;
340
-            byte highbyte = 0x00;
341
-            int count = 0;
342
-            bt = binr.ReadByte();
343
-            if (bt != 0x02)		//expect integer
344
-                return 0;
345
-            bt = binr.ReadByte();
346
-
347
-            if (bt == 0x81)
348
-                count = binr.ReadByte();	// data size in next byte
349
-            else
350
-                if (bt == 0x82)
351
-            {
352
-                highbyte = binr.ReadByte(); // data size in next 2 bytes
353
-                lowbyte = binr.ReadByte();
354
-                byte[] modint = { lowbyte, highbyte, 0x00, 0x00 };
355
-                count = BitConverter.ToInt32(modint, 0);
356
-            }
357
-            else
358
-            {
359
-                count = bt;     // we already have the data size
360
-            }
361
-
362
-
363
-
364
-            while (binr.ReadByte() == 0x00)
365
-            {	//remove high order zeros in data
366
-                count -= 1;
367
-            }
368
-            binr.BaseStream.Seek(-1, SeekOrigin.Current);		//last ReadByte wasn't a removed zero, so back up a byte
369
-            return count;
370
-        }
371
-
372
-        #region 解析.net 生成的Pem
373
-        private static RSAParameters ConvertFromPublicKey(string pemFileConent)
374
-        {
375
-
376
-            byte[] keyData = Convert.FromBase64String(pemFileConent);
377
-            if (keyData.Length < 162)
378
-            {
379
-                throw new ArgumentException("pem file content is incorrect.");
380
-            }
381
-            byte[] pemModulus = new byte[128];
382
-            byte[] pemPublicExponent = new byte[3];
383
-            Array.Copy(keyData, 29, pemModulus, 0, 128);
384
-            Array.Copy(keyData, 159, pemPublicExponent, 0, 3);
385
-            RSAParameters para = new RSAParameters();
386
-            para.Modulus = pemModulus;
387
-            para.Exponent = pemPublicExponent;
388
-            return para;
389
-        }
390
-
391
-        private static RSAParameters ConvertFromPrivateKey(string pemFileConent)
392
-        {
393
-            byte[] keyData = Convert.FromBase64String(pemFileConent);
394
-            if (keyData.Length < 609)
395
-            {
396
-                throw new ArgumentException("pem file content is incorrect.");
397
-            }
398
-
399
-            int index = 11;
400
-            byte[] pemModulus = new byte[128];
401
-            Array.Copy(keyData, index, pemModulus, 0, 128);
402
-
403
-            index += 128;
404
-            index += 2;//141
405
-            byte[] pemPublicExponent = new byte[3];
406
-            Array.Copy(keyData, index, pemPublicExponent, 0, 3);
407
-
408
-            index += 3;
409
-            index += 4;//148
410
-            byte[] pemPrivateExponent = new byte[128];
411
-            Array.Copy(keyData, index, pemPrivateExponent, 0, 128);
412
-
413
-            index += 128;
414
-            index += ((int)keyData[index + 1] == 64 ? 2 : 3);//279
415
-            byte[] pemPrime1 = new byte[64];
416
-            Array.Copy(keyData, index, pemPrime1, 0, 64);
417
-
418
-            index += 64;
419
-            index += ((int)keyData[index + 1] == 64 ? 2 : 3);//346
420
-            byte[] pemPrime2 = new byte[64];
421
-            Array.Copy(keyData, index, pemPrime2, 0, 64);
422
-
423
-            index += 64;
424
-            index += ((int)keyData[index + 1] == 64 ? 2 : 3);//412/413
425
-            byte[] pemExponent1 = new byte[64];
426
-            Array.Copy(keyData, index, pemExponent1, 0, 64);
427
-
428
-            index += 64;
429
-            index += ((int)keyData[index + 1] == 64 ? 2 : 3);//479/480
430
-            byte[] pemExponent2 = new byte[64];
431
-            Array.Copy(keyData, index, pemExponent2, 0, 64);
432
-
433
-            index += 64;
434
-            index += ((int)keyData[index + 1] == 64 ? 2 : 3);//545/546
435
-            byte[] pemCoefficient = new byte[64];
436
-            Array.Copy(keyData, index, pemCoefficient, 0, 64);
437
-
438
-            RSAParameters para = new RSAParameters();
439
-            para.Modulus = pemModulus;
440
-            para.Exponent = pemPublicExponent;
441
-            para.D = pemPrivateExponent;
442
-            para.P = pemPrime1;
443
-            para.Q = pemPrime2;
444
-            para.DP = pemExponent1;
445
-            para.DQ = pemExponent2;
446
-            para.InverseQ = pemCoefficient;
447
-            return para;
448
-        }
449
-        #endregion
450
-
451
-    }
452
-}

+ 2 - 4
ShopMobile/Mobile/View/Pay/pay_zfb.aspx.cs

@@ -28,10 +28,8 @@ namespace ShopMobile.View.Pay
28 28
                         if (bs != null)
29 29
                         {
30 30
                             Config.partner = bs.Alipay_PID;
31
-                            Config.seller_id = bs.Alipay_No;
32
-                            Config.private_key = bs.Alipay_PrivateKey;
33
-                            Config.alipay_public_key = bs.Alipay_PublicKey;
34
-
31
+                            Config.seller_id = bs.Alipay_PID;
32
+                            Config.key = bs.Alipay_PrivateKey;
35 33
 
36 34
                             string url = CommFun.GetDomainName();
37 35
 

+ 2 - 1
ShopMobile/ShopMobile.csproj

@@ -504,6 +504,7 @@
504 504
     <Content Include="Mobile\Img\推出.png" />
505 505
     <Content Include="Mobile\Img\收货地址.png" />
506 506
     <Content Include="Mobile\JS\avalon.mobile.min.js" />
507
+    <Content Include="Mobile\JS\fs_forse.js" />
507 508
     <Content Include="Mobile\JS\geo.js" />
508 509
     <Content Include="Mobile\JS\MobileCom.js" />
509 510
     <Content Include="Mobile\JS\zepto.md5.js" />
@@ -609,6 +610,7 @@
609 610
     <Compile Include="api\api.ashx.cs">
610 611
       <DependentUpon>api.ashx</DependentUpon>
611 612
     </Compile>
613
+    <Compile Include="Mobile\View\Pay\Alipay\MD5.cs" />
612 614
     <Compile Include="Properties\AssemblyInfo.cs" />
613 615
     <Compile Include="Mobile\View\ChkCode.aspx.cs">
614 616
       <DependentUpon>ChkCode.aspx</DependentUpon>
@@ -629,7 +631,6 @@
629 631
       <DependentUpon>return_url.aspx</DependentUpon>
630 632
       <SubType>ASPXCodeBehind</SubType>
631 633
     </Compile>
632
-    <Compile Include="Mobile\View\Pay\Alipay\RSA.cs" />
633 634
     <Compile Include="Mobile\View\Pay\pay_zfb.aspx.cs">
634 635
       <DependentUpon>pay_zfb.aspx</DependentUpon>
635 636
       <SubType>ASPXCodeBehind</SubType>