Esempio n. 1
0
        /// <summary>
        /// 通过参数配置初始化客户端
        /// 如果参数中配置了证书相关参数,需在此时初始化证书运行时环境对象,缓存证书相关上下文
        /// </summary>
        /// <param name="config">参数集合</param>
        public BaseClient(Dictionary <string, object> config)
        {
            this.Config = config;
            ArgumentValidator.CheckArgument(AlipayConstants.RSA2.Equals(GetConfig(AlipayConstants.SIGN_TYPE_CONFIG_KEY)),
                                            "Alipay Easy SDK只允许使用RSA2签名方式,RSA签名方式由于安全性相比RSA2弱已不再推荐。");

            if (!string.IsNullOrEmpty(GetConfig(AlipayConstants.ALIPAY_CERT_PATH_CONFIG_KEY)))
            {
                CertEnvironment = new CertEnvironment(
                    GetConfig(AlipayConstants.MERCHANT_CERT_PATH_CONFIG_KEY),
                    GetConfig(AlipayConstants.ALIPAY_CERT_PATH_CONFIG_KEY),
                    GetConfig(AlipayConstants.ALIPAY_ROOT_CERT_PATH_CONFIG_KEY));
            }
        }
Esempio n. 2
0
        public Context(Config config, string sdkVersion)
        {
            this.config = config.ToMap();
            SdkVersion  = sdkVersion;
            ArgumentValidator.CheckArgument(AlipayConstants.RSA2.Equals(GetConfig(AlipayConstants.SIGN_TYPE_CONFIG_KEY)),
                                            "Alipay Easy SDK只允许使用RSA2签名方式,RSA签名方式由于安全性相比RSA2弱已不再推荐。");

            if (!string.IsNullOrEmpty(GetConfig(AlipayConstants.ALIPAY_CERT_PATH_CONFIG_KEY)))
            {
                CertEnvironment = new CertEnvironment(
                    GetConfig(AlipayConstants.MERCHANT_CERT_PATH_CONFIG_KEY),
                    GetConfig(AlipayConstants.ALIPAY_CERT_PATH_CONFIG_KEY),
                    GetConfig(AlipayConstants.ALIPAY_ROOT_CERT_PATH_CONFIG_KEY));
            }
        }