Config.cs 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. //using System.Linq;
  5. using System.Web;
  6. /// <summary>
  7. /// 基础配置类
  8. /// </summary>
  9. namespace EMIS.Utility.OnlinePay.Alipay
  10. {
  11. public class Config
  12. {
  13. public static string alipay_public_key = @"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiyaUUHELeW+TBbEPep19IB/aVjakOZ9E3CKr4BXiC60kgQBXg6Ng8QRK7cEel3u3U0Tj4Eqe2hnRSCQPbvWOqFWPXvv+47bSXxyh4MCDgrBD11oSFjY7dD85DqW0vfr5kLBXKMze56o37sD1JKyTiUQnYo9sIrIock4eqMoBFks58yBdbdhhUweJizmPUnPATCMSlc03DuXvFNFxcNk3sVp3ZWt7YvMNo63xxt0snLVVT1Zc78eLVIQwQlizzMhDRy4IXpxNVIUmKxRiiM8+lFHZH6KinNXOBa/Z5gFyJa3cqfWWcbyRzeJx4BPsQaEmXmdAiDM+PnMdS2+PP9XJJwIDAQAB";
  14. //这里要配置没有经过的原始私钥
  15. //开发者私钥
  16. public static string merchant_private_key = @"MIIEpQIBAAKCAQEAraWP3Es6QGuQUoxYVXyxUNLuvwScI8H40tu1ha4TKRG6tjnTOPAIiquTRp4XkRqBJTXBLLAItof+AnUJnUaRDA1dJ7+GOsv/4uSxyqeEgGpd7eRQWJS17YVepzZEBQwyugILQd2ETA/+G1OJjB2DF3s7oGNxQlJcbl1PV/sOG6tIbYun4oKy1pmlCRrCnK4lVDAnXBHQ0ZYo8RilcOWfU/uXc4NH/FxVoE5QHcWD7Tgz7s+W/poX5a9jduvUCoJFo0AjFQpx2yKxy/gvFzQNkloICl0A0XjVolR6PrgqkVxAI7fJb93/S9W2IGAVZAT2AP77mDdQx+itwYMiL6AxpQIDAQABAoIBAAPul89ZNLx4sw/rdaSZ6jn2TMmuhQqaPd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2hRrstOK8lINgAr//kY9rDAcJo8758GmD02z/fKosr19FynvdxCrgdUgIf2JTvmAv8ESZ+SEYo1EP74qzXoWsRJdRCSwHVeTzUY2kFDM=";
  17. //开发者公钥
  18. public static string merchant_public_key = @"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAraWP3Es6QGuQUoxYVXyxUNLuvwScI8H40tu1ha4TKRG6tjnTOPAIiquTRp4XkRqBJTXBLLAItof+AnUJnUaRDA1dJ7+GOsv/4uSxyqeEgGpd7eRQWJS17YVepzZEBQwyugILQd2ETA/+G1OJjB2DF3s7oGNxQlJcbl1PV/sOG6tIbYun4oKy1pmlCRrCnK4lVDAnXBHQ0ZYo8RilcOWfU/uXc4NH/FxVoE5QHcWD7Tgz7s+W/poX5a9jduvUCoJFo0AjFQpx2yKxy/gvFzQNkloICl0A0XjVolR6PrgqkVxAI7fJb93/S9W2IGAVZAT2AP77mDdQx+itwYMiL6AxpQIDAQAB";
  19. //应用ID
  20. public static string appId = "2016102200735433";
  21. //合作伙伴ID:partnerID
  22. public static string pid = "2088102180581747";
  23. //支付宝网关
  24. //public static string serverUrl = "https://openapi.alipay.com/gateway.do";
  25. public static string serverUrl = "https://openapi.alipaydev.com/gateway.do";
  26. public static string mapiUrl = "https://mapi.alipay.com/gateway.do";
  27. public static string monitorUrl = "http://mcloudmonitor.com/gateway.do";
  28. //编码,无需修改
  29. public static string charset = "utf-8";
  30. //签名类型,支持RSA2(推荐!)、RSA
  31. //public static string sign_type = "RSA2";
  32. public static string sign_type = "RSA2";
  33. //版本号,无需修改
  34. public static string version = "1.0";
  35. /// <summary>
  36. /// 公钥文件类型转换成纯文本类型
  37. /// </summary>
  38. /// <returns>过滤后的字符串类型公钥</returns>
  39. public static string getMerchantPublicKeyStr()
  40. {
  41. StreamReader sr = new StreamReader(merchant_public_key);
  42. string pubkey = sr.ReadToEnd();
  43. sr.Close();
  44. if (pubkey != null)
  45. {
  46. pubkey= pubkey.Replace("-----BEGIN PUBLIC KEY-----", "");
  47. pubkey = pubkey.Replace("-----END PUBLIC KEY-----", "");
  48. pubkey = pubkey.Replace("\r", "");
  49. pubkey = pubkey.Replace("\n", "");
  50. }
  51. return pubkey;
  52. }
  53. /// <summary>
  54. /// 私钥文件类型转换成纯文本类型
  55. /// </summary>
  56. /// <returns>过滤后的字符串类型私钥</returns>
  57. public static string getMerchantPriveteKeyStr()
  58. {
  59. StreamReader sr = new StreamReader(merchant_private_key);
  60. string pubkey = sr.ReadToEnd();
  61. sr.Close();
  62. if (pubkey != null)
  63. {
  64. pubkey = pubkey.Replace("-----BEGIN PUBLIC KEY-----", "");
  65. pubkey = pubkey.Replace("-----END PUBLIC KEY-----", "");
  66. pubkey = pubkey.Replace("\r", "");
  67. pubkey = pubkey.Replace("\n", "");
  68. }
  69. return pubkey;
  70. }
  71. }
  72. }