Exemple #1
0
        /// <summary>
        /// 获取具有标准的Base64密码表的加密类
        /// </summary>
        /// <returns></returns>
        public static Base64Util GetStandardBase64()
        {
            var b64 = new Base64Util();

            b64.Pad       = "=";
            b64.CodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
            return(b64);
        }
Exemple #2
0
        /// <summary>
        /// 接收报文返回requsetBody和使用base64解析后的requsetBody以及缴费中心传送的签名
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public Dictionary <string, string> requestBodyOfBase64(string request)
        {
            Dictionary <string, string> requestMap = new Dictionary <string, string>();

            //使用base64解析完成后的requsetBody
            requestMap.Add("requsetBodyOfDecoded", "");
            //解析前的requsetBody
            requestMap.Add("requsetBody", "");
            //获取缴费中心传送过来的签名
            requestMap.Add("signatureString", "");

            if (logger.IsWarnEnabled)
            {
                logger.WarnFormat("收到的报文:{0}", request);
            }
            try
            {
                string signatureString = request.Substring(0, request.IndexOf("||"));
                logger.WarnFormat("截取报文的signatureString:", signatureString);
                string requsetBody = request.Substring(signatureString.Length + 2);
                logger.WarnFormat("截取报文的requsetBody:", requsetBody);
                string requsetBodyOfDecoded = Base64Util.DecodeData(requsetBody);
                //System.out.println("-----解析完成后的requsetBody-------" + requsetBodyOfDecoded);
                //使用base64解析完成后的requsetBody
                requestMap["requsetBodyOfDecoded"] = requsetBodyOfDecoded;
                //解析前的requsetBody
                requestMap["requsetBody"] = requsetBody;
                //获取缴费中心传送过来的签名
                requestMap["signatureString"] = signatureString;
            }
            catch (System.ArgumentOutOfRangeException e)
            {
                logger.Info(e.StackTrace);
            }
            return(requestMap);
        }