Example #1
0
        /// <summary>
        /// 获取工商银行验证信息
        /// </summary>
        /// <param name="tranData"></param>
        /// <returns></returns>
        public static string[] GetCheckInfo(string tranData)
        {
            var strMerSignMsg = string.Empty;
            var strMerCert    = string.Empty;
            var icbcObj       = new B2CUtil();
            var jg            = icbcObj.init(strCertFN, strCertFNM, strKeyFN, strKey);

            if (jg == 0)
            {
                strMerSignMsg = icbcObj.signC(tranData, tranData.Length);
                if (string.IsNullOrEmpty(strMerSignMsg))
                {
                    var returnCode = icbcObj.getRC();
                    WebApiConfig.log.Error("错误编码:" + returnCode + ",签名错误");
                }

                strMerCert = icbcObj.getCert(1);
            }
            else
            {
                WebApiConfig.log.Error(jg.ToString() + ",证书错误或私钥错误编码");
            }

            return(new string[] { strMerSignMsg, strMerCert });
        }
        /// <summary>
        /// 获取工商银行验证信息
        /// </summary>
        /// <param name="argIcbc"></param>
        /// <returns></returns>
        public static ICBCConfig GetCheckInfo(ICBCConfig argIcbc)
        {
            string  strMerSignMsg = string.Empty;
            B2CUtil icbcObj       = new B2CUtil();
            int     jg            = icbcObj.init(strCertFn, strCertFNM, strKeyFN, strKey);

            if (jg == 0)
            {
                argIcbc.MerSignMsg = icbcObj.signC(argIcbc.TranData, argIcbc.TranData.Length);
                if (argIcbc.MerSignMsg == "")
                {
                    int returnCode = icbcObj.getRC();
                    SpringFactory.BusinessFactory.GetBusinessAnonymousUser().AddLogs("错误编码:" + returnCode + ",签名错误");
                }
                argIcbc.MerCert = icbcObj.getCert(1);
                byte[] bytes = Encoding.Default.GetBytes(argIcbc.TranData);
                argIcbc.TranData = Convert.ToBase64String(bytes);
            }
            else
            {
                SpringFactory.BusinessFactory.GetBusinessAnonymousUser().AddLogs(jg.ToString() + ",证书错误或私钥错误编码");
            }
            return(argIcbc);
        }
        /// <summary>
        /// 获取工商银行验证信息
        /// </summary>
        /// <param name="argIcbc"></param>
        /// <returns></returns>
        public static MobileICBC GetCheckInfo(MobileICBC argIcbc)
        {
            string  strMerSignMsg = string.Empty;
            B2CUtil icbcObj       = new B2CUtil();
            int     jg            = icbcObj.init(strCertFN, strCertFNM, strKeyFN, strKey);

            if (jg == 0)
            {
                argIcbc.MerSignMsg = icbcObj.signC(argIcbc.TranData, argIcbc.TranData.Length);
                if (argIcbc.MerSignMsg == "")
                {
                    int returnCode = icbcObj.getRC();
                    //("错误编码:" + returnCode + ",签名错误");
                }
                argIcbc.MerCert = icbcObj.getCert(1);
                byte[] bytes = Encoding.Default.GetBytes(argIcbc.TranData);
                argIcbc.TranData = Convert.ToBase64String(bytes);
            }
            else
            {
                //(jg.ToString() + ",证书错误或私钥错误编码");
            }
            return(argIcbc);
        }
 /// <summary>
 /// 获取工商银行验证信息
 /// </summary>
 /// <param name="argIcbc"></param>
 /// <returns></returns>
 public static MobileICBC GetCheckInfo(MobileICBC argIcbc)
 {
     string strMerSignMsg = string.Empty;
     B2CUtil icbcObj = new B2CUtil();
     int jg = icbcObj.init(strCertFN, strCertFNM, strKeyFN, strKey);
     if (jg == 0)
     {
         argIcbc.MerSignMsg = icbcObj.signC(argIcbc.TranData, argIcbc.TranData.Length);
         if (argIcbc.MerSignMsg == "")
         {
             int returnCode = icbcObj.getRC();
             //("错误编码:" + returnCode + ",签名错误");
         }
         argIcbc.MerCert = icbcObj.getCert(1);
         byte[] bytes = Encoding.Default.GetBytes(argIcbc.TranData);
         argIcbc.TranData = Convert.ToBase64String(bytes);
     }
     else
     {
         //(jg.ToString() + ",证书错误或私钥错误编码");
     }
     return argIcbc;
 }