Esempio n. 1
0
        protected sealed override void Render(HtmlTextWriter writer)
        {
            base.Response.Clear();
            base.Response.Flush();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("NgbSecurity.HandleResponse('");
            stringBuilder.Append("<nxaml>");
            stringBuilder.Append("<object name=\"result\">");
            try
            {
                stringBuilder.Append("<string name=\"e\" value=\"" + this.GetEncryptExponent() + "\" />");
                stringBuilder.Append("<string name=\"m\" value=\"" + this.GetModulus() + "\" />");
                stringBuilder.Append("<string name=\"h\" value=\"" + this.CreateHashKey() + "\" />");
            }
            catch (Exception ex)
            {
                int      num;
                DateTime dateTime;
                ErrorLog.CreateErrorLog(ServiceCode.framework, 70000, null, ex.Message, ex.StackTrace, out num, out dateTime);
            }
            stringBuilder.Append("</object>");
            stringBuilder.Append("</nxaml>");
            stringBuilder.Append("');");
            writer.Write(stringBuilder.ToString());
        }
Esempio n. 2
0
 protected virtual void HandleSoapError(Exception e)
 {
     try
     {
         string text;
         string text2;
         if (this.WebServiceURLProvider != null && this.WebServiceURLProvider.GetProxyIP() != null && this.WebServiceURLProvider.GetProxyIP().Length != 0 && this.WebServiceURLProvider.GetProxyPort() != 0)
         {
             text  = this.WebServiceURLProvider.GetProxyIP();
             text2 = Convert.ToString(this.WebServiceURLProvider.GetProxyPort());
         }
         else
         {
             text  = "N/A";
             text2 = "N/A";
         }
         TSoap  soap = this.Soap;
         string url  = soap.Url;
         if (this.WebServiceURLProvider != null && this.WebServiceURLProvider.GetURL() != null && this.WebServiceURLProvider.GetURL().Length != 0)
         {
             url = this.WebServiceURLProvider.GetURL();
         }
         string[] array = url.Split(new char[]
         {
             '/'
         });
         string arg = string.Empty;
         arg = ((array.Length > 0) ? array[array.Length - 1] : "Unknown");
         string strErrorMessage = string.Format("{0} : {1}", arg, e.Message);
         string text3           = string.Format("Message:{0}\r\n", e.Message);
         text3 += string.Format("T:{0:00000}|R:{1:00}|I:{2}|P:{3}\r\n", new object[]
         {
             this.SoapTimeout,
             this.RetryCount,
             text,
             text2
         });
         text3 += string.Format("Server:{0}\r\n", (array.Length > 2) ? array[array.Length - 2] : "Unknown");
         text3 += string.Format("Url:{0}\r\n", url);
         text3 += string.Format("Dump:{0}", e.StackTrace);
         int      num;
         DateTime dateTime;
         ErrorLog.CreateErrorLog(this.serviceCode, 50000, null, strErrorMessage, text3, out num, out dateTime);
     }
     catch (Exception)
     {
     }
 }
Esempio n. 3
0
 protected virtual bool HandleDBError(Exception e)
 {
     try
     {
         if (!(this.SQLConnectionStringProvider is ErrorLogConnectionStringProvider))
         {
             string   strErrorMessage = string.Format("{0} : {1}", this.SPName, e.Message);
             string   strStackTrace   = string.Format("Message:{0}", e.Message);
             int      num;
             DateTime dateTime;
             ErrorLog.CreateErrorLog(this.serviceCode, 30000, null, strErrorMessage, strStackTrace, out num, out dateTime);
         }
     }
     catch (Exception)
     {
     }
     return(false);
 }
Esempio n. 4
0
 protected virtual bool HandleDBError(Exception e)
 {
     try
     {
         if (!(this.SQLConnectionStringProvider is ErrorLogConnectionStringProvider))
         {
             string strErrorMessage = string.Format("{0} : {1}", this._cmd.CommandText, e.Message);
             string text            = string.Format("Message:{0}", e.Message);
             text += string.Format("\r\nDump:{0}", this.Dump());
             int      num;
             DateTime dateTime;
             ErrorLog.CreateErrorLog(this.serviceCode, 30000, null, strErrorMessage, text, out num, out dateTime);
         }
     }
     catch (Exception)
     {
     }
     return(false);
 }
Esempio n. 5
0
        public void InitCrypto(string file)
        {
            StreamReader streamReader = null;

            try
            {
                this._sp = new RSACryptoServiceProvider(new CspParameters
                {
                    Flags = CspProviderFlags.UseMachineKeyStore
                });
                streamReader = new StreamReader(file);
                string xmlString = streamReader.ReadToEnd();
                this._sp.FromXmlString(xmlString);
            }
            catch (Exception ex)
            {
                if (ex is IOException)
                {
                    int      num;
                    DateTime dateTime;
                    ErrorLog.CreateErrorLog(ServiceCode.framework, 70000, null, "RSAWrapper : Invalid Key File Info", string.Format("{0} --> {1}", ex.Message, ex.StackTrace), out num, out dateTime);
                }
                else
                {
                    int      num;
                    DateTime dateTime;
                    ErrorLog.CreateErrorLog(ServiceCode.framework, 70000, null, string.Format("RSAWrapper : {0}", ex.Message), string.Format("{0} --> {1}", ex.Message, ex.StackTrace), out num, out dateTime);
                }
                throw;
            }
            finally
            {
                if (streamReader != null)
                {
                    streamReader.Close();
                    streamReader = null;
                }
            }
        }
Esempio n. 6
0
 protected virtual void HandleDBError(SqlException ex)
 {
     try
     {
         if (!(this.SQLConnectionStringProvider is ErrorLogConnectionStringProvider))
         {
             string strErrorMessage = string.Format("{0},{1}.{2},{3}", new object[]
             {
                 this.SPName,
                 ex.Server,
                 ex.Procedure,
                 ex.Message
             });
             string   strStackTrace = string.Format("Message:{0}", ex.StackTrace);
             int      num;
             DateTime dateTime;
             ErrorLog.CreateErrorLog(this.serviceCode, 30000, null, strErrorMessage, strStackTrace, out num, out dateTime);
         }
     }
     catch (Exception)
     {
     }
 }
Esempio n. 7
0
        public string[] Decrypt(string data, bool checkHash)
        {
            string text  = string.Empty;
            string text2 = string.Empty;

            string[] result;
            try
            {
                try
                {
                    StringBuilder stringBuilder = new StringBuilder(256);
                    string[]      array         = data.Split(new char[]
                    {
                        ' '
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        stringBuilder.Append(RSACore.Decrypt(array[i]));
                    }
                    text = stringBuilder.ToString();
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format("decrypt failed ({0})", ex.Message));
                }
                string[] array2 = text.Split(new char[]
                {
                    '\\'
                });
                string[] array3;
                if (checkHash)
                {
                    if (array2.Length < 2)
                    {
                        throw new Exception("hash key invalid");
                    }
                    text2  = array2[0];
                    array3 = new string[array2.Length - 1];
                    if (this.CheckHashKey(text2))
                    {
                        for (int j = 0; j < array2.Length - 1; j++)
                        {
                            array3[j] = this.Convert(array2[j + 1]);
                        }
                    }
                    else
                    {
                        for (int k = 0; k < array2.Length - 1; k++)
                        {
                            array3[k] = string.Empty;
                        }
                    }
                }
                else
                {
                    array3 = new string[array2.Length];
                    for (int l = 0; l < array2.Length; l++)
                    {
                        array3[l] = this.Convert(array2[l]);
                    }
                }
                result = array3;
            }
            catch (Exception ex2)
            {
                int      num;
                DateTime dateTime;
                ErrorLog.CreateErrorLog(ServiceCode.framework, 70000, null, string.Format("RSAWrapper : {0}", ex2.Message), string.Format("Message={0} & ClientIP={1} & EncData={2} & HashKey={3} & StackTrace={4}", new object[]
                {
                    ex2.Message,
                    (HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : string.Empty,
                    data,
                    text2,
                    ex2.StackTrace
                }), out num, out dateTime);
                throw ex2;
            }
            return(result);
        }