Exemplo n.º 1
0
        static void Main(string[] args)
        {
            List <string> archivo2 = File.ReadLines(AppDomain.CurrentDomain.BaseDirectory + @"\resources\DOCUMENTO2.DAT").ToList();            //toma el archivo a desencriptar
            List <string> result   = new List <string>();                                                                                      //lista que obtendra los resultados de la desencriptacion

            archivo2.ForEach(frases => {                                                                                                       //foreach que mira cada linea del archivo 2
                string[] mensaje = Regex.Split(frases, ">");                                                                                   //separa el texto a desencriptar de las instrucciones
                result.Add(Tools2.Decrypt(mensaje[1], File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\resources\publickey.xml"))); //desencripta el texto y lo agrega a la lista
            });
            Tools.CreateFile(result, "decriptedFile2");                                                                                        //crea el archivo con los resultados

            Console.ReadLine();
        }
Exemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            //_debug = true;

            SecCred = new SecurityCredentials();

            if (System.Configuration.ConfigurationManager.AppSettings["usesAD"] != null)
            {
                _usesAD = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["usesAD"]);
            }

            AU = new Authentication(SecCred, _usesAD);

            if (_usesAD)
            {
                WSSecurity = new WebSecure(Response, Request, Session);
                userID     = WSSecurity.AuthenticateUser();
                if (userID.Length > 0)
                {
                    Profile p = AU.GetUserProfile(userID);
                    userFriendlyName = p.friendlyName;
                    userEmail        = p.email;
                }
            }
            else
            {
                userID = AU.getPortalCookie(Request, Response);
                if (userID.Length == 0)
                {
                    if (!Request.ServerVariables["PATH_INFO"].Contains("Login"))
                    {
                        Response.Redirect("Login/default.aspx");
                    }
                }
            }

            _webServer           = this.Request.Url.Authority;
            _webConfig_WebServer = System.Configuration.ConfigurationManager.AppSettings["WebServer"];
            _appPath             = Request.ApplicationPath;

            _BP = Request["BP"] + "";
            if (_BP == "")
            {
                _BP = "1100";
            }

            workflowID = Request["workflowID"] + "";
            if (workflowID.Length == 0 || workflowID == "-1")
            {
                workflowID = "0";
            }

            _stepID     = Request["stepID"];
            _stepUserID = Request["stepUserID"] + "";

            _dbName          = System.Configuration.ConfigurationManager.AppSettings["dbName"];
            _appFriendlyName = System.Configuration.ConfigurationManager.AppSettings["AppFriendlyName"];

            tools = new Tools2(_BP, userID, SecCred, _usesAD);

            _culture            = UserCulture();
            _nfi                = (NumberFormatInfo)_culture.NumberFormat.Clone();
            _nfi.CurrencySymbol = "$";

            string       filename = Server.MapPath("~/CSS/osx2_1.css");
            StreamReader sr       = File.OpenText(filename);
            string       s        = sr.ReadToEnd();

            workflow2 = new Workflow2(SecCred, _BP, userID, _culture, s, 700, _usesAD);


            dbServerModeStruct sms = SecCred.GetServerMode(Request.Url.Host);

            _ServerModeOptions = sms.Options;

            if (System.Configuration.ConfigurationManager.AppSettings["RoutingDebugStatus"] != null && sms.Mode != "P")
            {
                workflow2.debug      = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["RoutingDebugStatus"]);
                workflow2.debugUsers = System.Configuration.ConfigurationManager.AppSettings["RoutingDebugEmail"];
            }

            _DBStatus = Routing2.DBStatus.NotStarted;

            myHeaderDT = tools.getHeader(workflowID, false);
            if (myHeaderDT.Rows.Count > 0)
            {
                if (myHeaderDT.Rows[0]["BP"].ToString() != _BP)
                {
                    _BP = myHeaderDT.Rows[0]["BP"].ToString();
                }

                tools.BP      = _BP;
                workflow2._BP = _BP;

                _isOwner  = tools.IsOwner(workflowID);
                _DBStatus = workflow2.WorkflowStatusEnum((int)myHeaderDT.Rows[0]["Status"]);
            }

            PageTitle = _appFriendlyName;

            _isAdmin = tools.isAdmin(_BP);

            //if (Request["Edit"] + "" == "1" || Request["Edit"] + "" == "True" && (_isOwner || _isAdmin))// _hasModifyRights)
            //  _editRequest = true;

            myCook = new SQLCookies(_appFriendlyName, userID, SecCred);

            sqlConn = new SqlConnection();
            sqlConn.ConnectionString = SecCred.ConnectionStringSQL(_dbName);

            base.OnInit(e);
        }