Esempio n. 1
0
//		private string leggiPasswordDelDipIniziale(DataTable tDipAmmin, object iddbdepartment) {
//			string filtroDip = "(iddbdepartment=" + QueryCreator.quotedstrvalue(iddbdepartment, false) + ")";
//			DataRow rAccess = tDipAmmin.Select(filtroDip)[0];
//			byte[] alfa1 = QueryCreator.StringToByteArray((string)rAccess["alpha1"]);
//
//			UTF8Encoding encoding = new UTF8Encoding();
//			SHA256 shaM = new SHA256Managed();
//			byte[] initialPassword = encoding.GetBytes(Easy_DataAccess.INITIAL_PASSWORD);
//			byte[] alfa = shaM.ComputeHash(initialPassword);
//			byte[] up = xor(alfa, alfa1);
//			return DataAccess.DecryptString(up);
//		}
//
//		private string leggiPasswordDelDipCambiata(DataTable tDipAmmin, object iddbdepartment) {
//			string filtroDip = "(iddbdepartment=" + QueryCreator.quotedstrvalue(iddbdepartment, false) + ")";
//			DataRow rAccess = tDipAmmin.Select(filtroDip)[0];
//			string sAlfa1 = (string) rAccess["alpha1"];
//			byte[] alfa1 = QueryCreator.StringToByteArray(sAlfa1);
//
//			byte[] alfa = dataAccess.sha256UserPassword();
//			byte[] up = xor(alfa, alfa1);
//			try {
//				return DataAccess.DecryptString(up);
//			} catch (CryptographicException) {
//				return null;
//			}
//		}
//
        private void button1_Click(object sender, System.EventArgs e)
        {
            DataTable t  = Meta.Conn.RUN_SELECT("tabelle", null, null, null, null, null, false);
            DataSet   ds = new DataSet();

            ds.Tables.Add(t);
            ds.WriteXml("c:/tabelle.xml");
            string    filtroAmmin = "(login="******"user"), false) + ")";
            DataTable tDipAmmin   = DataAccess.RUN_SELECT(Meta.Conn, "dbaccess", null, null, filtroAmmin, null, null, true);

            textBox1.Text = null;
            foreach (DataRow rDepartment in tDipAmmin.Rows)
            {
                string iddbdepartment = (string)rDepartment["iddbdepartment"];
                string errore;
                string passwordDip = Easy_DataAccess.DecryptString(dataAccess.getDepartmentPassword(iddbdepartment, out errore));
                textBox1.Text += rDepartment["iddbdepartment"] + ": " + passwordDip + "\r\n";
            }
        }