예제 #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 });
        }
예제 #2
0
        /// <summary>
        /// 获取工商银行验证信息
        /// </summary>
        /// <param name="argIcbc"></param>
        /// <returns></returns>
        public static bool GetCheckReturnInfo(string tranData, string merSignMsg)
        {
            string  strMerSignMsg = string.Empty;
            B2CUtil icbcObj       = new B2CUtil();

            if (icbcObj.init(strCertFN, strCertFNM, strKeyFN, strKey) == 0)
            {
                tranData = Decode(tranData);
                //判断验证银行签名是否成功
                if (icbcObj.verifySignC(tranData, tranData.Length, merSignMsg, merSignMsg.Length) == 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        /// <summary>
        /// 获取工商银行验证信息
        /// </summary>
        /// <param name="argIcbc"></param>
        /// <returns></returns>
        public static ICBCConfig GetCheckReturnInfo(ICBCConfig argIcbc)
        {
            string  strMerSignMsg = string.Empty;
            B2CUtil icbcObj       = new B2CUtil();

            if (icbcObj.init(strCertFn, strCertFNM, strKeyFN, strKey) == 0)
            {
                argIcbc.TranData = Decode(argIcbc.TranData);
                //判断验证银行签名是否成功
                if (icbcObj.verifySignC(argIcbc.TranData, argIcbc.TranData.Length, argIcbc.MerSignMsg, argIcbc.MerSignMsg.Length) == 0)
                {
                    argIcbc.IsCheck = true;
                }
                else
                {
                    argIcbc.IsCheck = true;
                }
            }
            else
            {
                argIcbc.IsCheck = false;
            }
            return(argIcbc);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        /// <summary>
        /// 获取工商银行验证信息
        /// </summary>
        /// <param name="argIcbc"></param>
        /// <returns></returns>
        public static MobileICBC GetCheckReturnInfo(MobileICBC argIcbc)
        {
            string strMerSignMsg = string.Empty;
            B2CUtil icbcObj = new B2CUtil();

            if (icbcObj.init(strCertFN, strCertFNM, strKeyFN, strKey) == 0)
            {
                argIcbc.TranData = Common.Decode(argIcbc.TranData);
                //判断验证银行签名是否成功
                if (icbcObj.verifySignC(argIcbc.TranData, argIcbc.TranData.Length, argIcbc.MerSignMsg, argIcbc.MerSignMsg.Length) == 0)
                {
                    argIcbc.IsCheck = true;
                }
                else
                    argIcbc.IsCheck = true;
            }
            else
            {
                argIcbc.IsCheck = false;
            }
            return argIcbc;
        }
예제 #7
0
 /// <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;
 }