Esempio n. 1
0
        public static string SEED_K = "SESshxdRu3p4ik3IOxM6/qAWmmTYUw8N1ZGIh1Pgh2w=$pQgQvA49Cmwn8s7xRUxHmA==";//"sec.key";

        static Common()
        {
            //SI NO HAY WRAPPERS CARGA DIRECTAMENTE
            if (WrapperFactory.ProviderSection.Providers.Count.Equals(0))
            {
                CnnString          = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
                CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
            }
            else
            {
                //SI HAY, CHEQUEA QUE SEA LOCAL
                if (!WrapperFactory.ProviderSection.DefaultProvider.WrapperProviderType.Equals("LocalWrapper"))
                {
                    CnnString          = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
                    CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
                }
            }

            Fwk.Security.Cryptography.FwkSymetricAlg s = new FwkSymetricAlg(SEED_K);
            ISymetriCypher = s;// SymetricCypherFactory.Cypher();// SymetricCypherFactory.Get<RijndaelManaged>(SEED_K);

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
            {
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Busca un cryptographer determinado por medio de su nombre
        /// </summary>
        /// <param name="providerName">nombre proveedor configurado en el .config</param>
        /// <returns>Argoritmo ISymetriCypher</returns>
        public static ISymetriCypher Cypher(string providerName)
        {
            InitializeProviders();

            if (String.IsNullOrEmpty(providerName))
            {
                providerName = _CypherProviders.DefaultProviderName;
            }

            ISymetriCypher symetriCypher = null;


            //Busca el SymetriCypher en el diccionario
            if (CypherProviders.ContainsKey(providerName))
            {
                symetriCypher = (ISymetriCypher)CypherProviders[providerName];
            }

            else
            {
                TechnicalException te = new TechnicalException(String.Format(Fwk.Bases.Properties.Resources.setting_provider_not_found, providerName, "FwkCypherProvider"));
                te.ErrorId = "4401";
                throw te;
            }
            return(symetriCypher);
        }
Esempio n. 3
0
        public static string SEED_K = "SESshxdRu3p4ik3IOxM6/qAWmmTYUw8N1ZGIh1Pgh2w=$pQgQvA49Cmwn8s7xRUxHmA==";//"sec.key";

        static Common()
        {
            //SI NO HAY WRAPPERS CARGA DIRECTAMENTE 
            if (WrapperFactory.ProviderSection.Providers.Count.Equals(0))
            {
                CnnString = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
                CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
            }
            else
            {
                //SI HAY, CHEQUEA QUE SEA LOCAL
                if (!WrapperFactory.ProviderSection.DefaultProvider.WrapperProviderType.Equals("LocalWrapper"))
                {
                    CnnString = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
                    CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
                 
                }
                
            }

            Fwk.Security.Cryptography.FwkSymetricAlg s = new FwkSymetricAlg(SEED_K);
            ISymetriCypher = s;// SymetricCypherFactory.Cypher();// SymetricCypherFactory.Get<RijndaelManaged>(SEED_K);

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
        }
Esempio n. 4
0
        public static string SEED_K = "SESshxdRu3p4ik3IOxM6/qAWmmTYUw8N1ZGIh1Pgh2w=$pQgQvA49Cmwn8s7xRUxHmA==";//"sec.key";

        static Common()
        {
            CnnString = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
            CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
            ISymetriCypher = SymetricCypherFactory.Get<RijndaelManaged>(SEED_K);

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
        }
Esempio n. 5
0
        public static string SEED_K = "SESshxdRu3p4ik3IOxM6/qAWmmTYUw8N1ZGIh1Pgh2w=$pQgQvA49Cmwn8s7xRUxHmA==";//"sec.key";

        static Common()
        {
            CnnString          = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
            CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
            ISymetriCypher     = SymetricCypherFactory.Get <RijndaelManaged>(SEED_K);

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
            {
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
            }
        }
Esempio n. 6
0
        static Common()
        {

            if (!WrapperFactory.ProviderSection.DefaultProvider.WrapperProviderType.Equals("LocalWrapper"))
            {
                CnnString = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
                CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["CNN_STRING_Entities"].ConnectionString;
            }
            ISymetriCypher = SymetricCypherFactory.Get<RijndaelManaged>(SEED_K);

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
        }
Esempio n. 7
0
        static Common()
        {
            if (!WrapperFactory.ProviderSection.DefaultProvider.WrapperProviderType.Equals("LocalWrapper"))
            {
                CnnString          = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
                CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["CNN_STRING_Entities"].ConnectionString;
            }
            ISymetriCypher = SymetricCypherFactory.Get <RijndaelManaged>(SEED_K);

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
            {
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
            }
        }
Esempio n. 8
0
        public static string SEED_K = "SESshxdRu3p4ik3IOxM6/qAWmmTYUw8N1ZGIh1Pgh2w=$pQgQvA49Cmwn8s7xRUxHmA==";//"sec.key";

        static Common()
        {
            //SI NO HAY WRAPPERS CARGA DIRECTAMENTE 
            //if (WrapperFactory.ProviderSection.Providers.Count.Equals(0))
            //{
                CnnString = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
                CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
            //}
           
            // SymetricCypherFactory.Cypher();// SymetricCypherFactory.Get<RijndaelManaged>(SEED_K);
            SymetriCypher<AesManaged> s = new SymetriCypher<AesManaged>(SEED_K);
            
            
            ISymetriCypher = s;

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
        }
Esempio n. 9
0
        static Common()
        {
            expirationDate = DateTime.Now.AddSeconds(ExpirationSeconds);
            //string domains = "";
            //-1 = This value does the reverse of 0.It makes the password not expired
            if (System.Configuration.ConfigurationManager.AppSettings["mustChangedNextLogon"] != null)
            {
                mustChangedNextLogon = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["mustChangedNextLogon"]);
            }

            ISymetriCypher = new SymetriCypher <RijndaelManaged>(SEED_K);

            //if (domains == null)
            //{
            //    throw new TechnicalException("No se encontro configurada la appSetting secConfig ");
            //}
            //if (!System.IO.File.Exists(domains))
            //{
            //    throw new TechnicalException("No se encontro el archivo " + domains);
            //}

            //string domainsJson = FileFunctions.OpenTextFile(domains);



            try
            {
                DomainUrlInfoList = Fwk.Security.ActiveDirectory.DirectoryServicesBase.DomainsUrl_Get_FromSp_all(Common.CnnStringNameAD);
                //Domains = new List<DomainsBE>();
                //DomainsBE dbe =null;
                //DomainUrlInfoList.ForEach(d =>
                //{
                //    dbe = new DomainsBE();
                //    dbe.Domain = d.SiteName;
                //    Domains.Add(dbe);

                //});
                //Domains = (List<DomainsBE>)SerializationFunctions.DeSerializeObjectFromJson(typeof(List<DomainsBE>), domainsJson);
            }
            catch (Exception ex)
            {
                throw new TechnicalException(ex.Message);// "El archivo " + domains + " No tiene un formato correcto");
            }
        }
Esempio n. 10
0
        public static string SEED_K = "SESshxdRu3p4ik3IOxM6/qAWmmTYUw8N1ZGIh1Pgh2w=$pQgQvA49Cmwn8s7xRUxHmA==";//"sec.key";

        static Common()
        {
            //SI NO HAY WRAPPERS CARGA DIRECTAMENTE
            //if (WrapperFactory.ProviderSection.Providers.Count.Equals(0))
            //{
            CnnString          = System.Configuration.ConfigurationManager.ConnectionStrings[CnnStringName].ConnectionString;
            CnnString_Entities = System.Configuration.ConfigurationManager.ConnectionStrings["HealthEntities"].ConnectionString;
            //}

            // SymetricCypherFactory.Cypher();// SymetricCypherFactory.Get<RijndaelManaged>(SEED_K);
            SymetriCypher <AesManaged> s = new SymetriCypher <AesManaged>(SEED_K);


            ISymetriCypher = s;

            if (System.Configuration.ConfigurationManager.AppSettings["logOnFile"] != null)
            {
                logOnFile = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["logOnFile"]);
            }
        }
Esempio n. 11
0
        private void btnKey_Click(object sender, EventArgs e)
        {
            ISymetriCypher wISymetriCypher = SymetricCypherFactory.Get <RijndaelManaged>(txtReference.Text);

            txtReference.Text = wISymetriCypher.CreateKeyFile();
        }
Esempio n. 12
0
        private void btnDEncrypt_Click(object sender, EventArgs e)
        {
            ISymetriCypher wISymetriCypher = SymetricCypherFactory.Get <RijndaelManaged>(txtReference.Text);

            txtNoCifrado.Text = wISymetriCypher.Dencrypt(txtCifrado.Text);
        }