예제 #1
0
        protected void ddlTipos_SelectedIndexChanged(object sender, EventArgs e)
        {
            pnlMsjP.Visible = true;
            imgPass.Visible = false;

            BLBovedaContra objBov = new BLBovedaContra();
            int            Tipo   = 0;

            lblMsjP.Text = "";
            int.TryParse(ddlTiposS.SelectedValue, out Tipo);

            if (Tipo > 0)
            {
                objBov.ObtenerListaP(ref ddlListaP, hddHash.Value, Tipo);

                if (ddlListaP.Items.Count > 1)
                {
                    ddlListaP.Visible = true;
                }
                else
                {
                    ddlListaP.Visible = false;
                    lblMsjP.Text      = "No se encontraron contraseñas encriptadas con la llave proporcionada";
                }
            }
            else
            {
                ddlListaP.DataSource = null;
                ddlListaP.DataBind();
                ddlListaP.Visible = false;
            }
        }
예제 #2
0
        protected void btnProcesar_Click(object sender, EventArgs e)
        {
            BLBovedaContra objBov  = new BLBovedaContra();
            string         Errores = "";

            if (rbTodos.Checked)
            {
                Errores = objBov.GuardarLlave(Session["UserNameLogin"].ToString());
            }

            if (rbEspecial.Checked)
            {
                txtCorreo.Text = txtCorreo.Text.Trim();

                if (DatosGenerales.EsEmail(txtCorreo.Text))
                {
                    Errores = objBov.GuardarLlave(Session["UserNameLogin"].ToString(), txtCorreo.Text);
                }
                else
                {
                    Errores = "No es un correo válido";
                }
            }

            if (Errores == "")
            {
                DatosGenerales.EnviaMensaje("Revise su correo para obtenerla. Puede tardar unos minutos.", "Llave generada", DatosGenerales.TiposMensaje.Informacion);
            }
            else
            {
                DatosGenerales.EnviaMensaje(Errores, "Proceso interrumpido", DatosGenerales.TiposMensaje.Error);
            }
        }
예제 #3
0
        protected string IngresarContrasenna(string Hash, int Tipo, string UserName, string Objeto, string vLogin, string Pass)
        {
            BLBovedaContra objBov = new BLBovedaContra();

            De_CryptDLL.De_Crypt crypto = new De_CryptDLL.De_Crypt();
            string Errores = "";

            Pass    = crypto.Encriptar(Pass, Objeto + vLogin + hddKey.Value, true);
            Errores = objBov.IngresarContrasenna(Hash, Tipo, UserName, Objeto, vLogin, Pass);

            return(Errores);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                txtFecha.Text = DateTime.Now.ToString("dd/MM/yyyy");
                objCon.ObtenerCatalogos(ref ddlAdministradora, (int)DatosGenerales.ConstanciasCatalogos.Administradoras, 0, true, "Seleccionar administradora");
            }

            if (IsPostBack)
            {
                bool   fileOK = false;
                string path   = Server.MapPath("../Reportes/TmpFiles/");

                if (upFile.HasFile && hddArchivo.Value == "")
                {
                    string   fileExtension     = System.IO.Path.GetExtension(upFile.FileName).ToLower();
                    string[] allowedExtensions = { ".txt" };

                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                        }
                    }

                    if (fileOK)
                    {
                        try
                        {
                            BLBovedaContra objBov  = new BLBovedaContra();
                            string         Archivo = path + DatosGenerales.GeneraNombreArchivoRnd("Const_", "txt");

                            hddArchivoOriginal.Value = upFile.FileName;
                            upFile.PostedFile.SaveAs(Archivo);
                            hddArchivo.Value = Archivo;

                            ValidaDatos(Archivo);
                        }
                        catch (Exception ex)
                        {
                            lblMsjCarga.Text = "No se pudo cargar el archivo: " + ex.Message;
                        }
                    }
                    else
                    {
                        lblMsjCarga.Text = "Tipo de archivo incorrecto.";
                    }
                }
            }
        }
예제 #5
0
        protected void ddlListaP_SelectedIndexChanged(object sender, EventArgs e)
        {
            pnlMsjP.Visible = true;
            imgPass.Visible = false;

            BLBovedaContra objBov = new BLBovedaContra();

            De_CryptDLL.De_Crypt crypto = new De_CryptDLL.De_Crypt();
            int Id = 0;

            int.TryParse(ddlListaP.SelectedValue, out Id);
            BLBovedaContra.DatosPass Datos = new BLBovedaContra.DatosPass(Id);

            if (Datos.Pass != "")
            {
                GeneraImagen(crypto.Desencriptar(Datos.Pass, Datos.Objeto + Datos.Login + hddKey.Value, true));
            }
            else
            {
                lblMsjP.Text = "No se encontraron contraseñas encriptadas con el elemento seleccionado";
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BLBovedaContra objBov = new BLBovedaContra();

                string script = "$(document).ready(function () { $('[id*=btnSubmit]').click(); });";
                ClientScript.RegisterStartupScript(this.GetType(), "load", script, true);
                objBov.ObtenerListaTipos(ref ddlTiposS);
            }

            if (IsPostBack && hddKey.Value == "")
            {
                bool   fileOK = false;
                string path   = Server.MapPath("../Reportes/TmpFiles/");

                pnlDatos.Visible  = false;
                pnlDatosM.Visible = false;

                if (upFile.HasFile)
                {
                    string   fileExtension     = System.IO.Path.GetExtension(upFile.FileName).ToLower();
                    string[] allowedExtensions = { ".bkey" };

                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                        }
                    }

                    if (fileOK)
                    {
                        try
                        {
                            BLBovedaContra objBov  = new BLBovedaContra();
                            string         Archivo = path + DatosGenerales.GeneraNombreArchivoRnd("Bov_", "bkey");

                            upFile.PostedFile.SaveAs(Archivo);
                            hddKey.Value = System.IO.File.ReadAllText(Archivo);
                            System.IO.File.Delete(Archivo);

                            if (objBov.VerificarHash(DatosGenerales.ObtenerHashCadena(hddKey.Value)) > 0)
                            {
                                pnlCarga.Visible = false;
                                hddHash.Value    = DatosGenerales.ObtenerHashCadena(hddKey.Value);
                                objBov.ObtenerListaTipos(ref ddlTiposS);

                                if (rbMultiple.Checked)
                                {
                                    pnlDatosM.Visible = true;
                                }
                                else
                                {
                                    pnlDatos.Visible = true;
                                }
                            }
                            else
                            {
                                lblMsjCarga.Text = "No se encontró el Hash suministrado.";
                            }
                        }
                        catch (Exception ex)
                        {
                            lblMsjCarga.Text = "No se pudo cargar el archivo: " + ex.Message;
                        }
                    }
                    else
                    {
                        lblMsjCarga.Text = "Tipo de archivo incorrecto.";
                    }
                }
            }
        }