static void Main(string[] args)
        {
            //acıkkey();

            Kripto  kapalı = new Kripto();
            Kripto1 acik   = new Kripto1();

            while (true)
            {
                Console.WriteLine("şifrelemek için '1' çevirmek için '0'");
                string bust = Console.ReadLine();
                if (bust == "1")
                {
                    acik.acıkkey();
                }
                else if (bust == "0")
                {
                    kapalı.kapalıkey();
                }
                else
                {
                    Console.WriteLine("geçersizz giriş!");
                }
            }
        }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //HAshiraj lozinku
        string sol = DateTime.Now.Millisecond.ToString() + "sol";
        // Prvi hash
        string lozinka = Kripto.Hash(tb_lozinka.Text + sol);

        // Još jedan hash
        lozinka = Kripto.Hash(lozinka + sol);

        // Kako ćemo unijeti korisnika
        // Copy paste
        //Čitaj iz web configa
        string connectionString = WebConfigurationManager.ConnectionStrings["BazaCS"].ConnectionString;
        // Kreiraj konekciju na Bazu preko connection stringa
        SqlConnection connection = new SqlConnection(connectionString);
        // Sad kreiraj komandu
        SqlCommand command = new SqlCommand();

        // daj konekciju
        command.Connection = connection;
        // SQL koji ćemo izvesti, sada uvodimo parametre u priču (placeholder)
        command.CommandText = "INSERT INTO Korisnik VALUES (@ime, @lozinka, @sol)";
        // Idemo sada zamijeniti parametre s vrijdnostima
        command.Parameters.AddWithValue("ime", tb_ime.Text);
        // Hashirana lozinka
        command.Parameters.AddWithValue("lozinka", lozinka);
        // I njena sol
        command.Parameters.AddWithValue("sol", sol);
        // koja vrsta komande
        command.CommandType = System.Data.CommandType.Text;
        // opet otvori konekciju i izvrši SQL
        try
        {
            // poveži se
            connection.Open();
            // Non query je upit koji ne očekuje podatke, već ih mijenja
            int kolikoRedova = command.ExecuteNonQuery(); // vraća broj promijenjenih redova
            // Morao bi kreirati samo jedan red
            if (kolikoRedova != 1)
            {
                throw new Exception("Nije dobro ");
            }
            else
            {
                prikaziKorisnike();
            }
        }
        catch (SqlException ex)
        {
            // Nešto napravi
        }
        finally // on se uvijek izvodi
        {
            // Zatvori konekciju
            connection.Close();
        }
    }
Beispiel #3
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        //Provjeri je li login dobar i ako je pošalji ga na drugu
        // Spoji se na bazu i vidi ima li korisnik s tim imenom
        //Čitaj iz web configa
        string connectionString = WebConfigurationManager.ConnectionStrings["BazaCS"].ConnectionString;
        // Kreiraj konekciju na Bazu preko connection stringa
        SqlConnection connection = new SqlConnection(connectionString);
        // Sad kreiraj komandu
        SqlCommand command = new SqlCommand();

        // daj konekciju
        command.Connection = connection;
        // SQL koji ćemo izvesti
        command.CommandText = "SELECT lozinka, sol FROM Korisnik WHERE ime = @ime";
        command.Parameters.AddWithValue("ime", tb_lime.Text);

        // idemo na bazu
        try
        {
            // poveži se
            connection.Open();
            // Izvrši SQL i primi podatke
            SqlDataReader reader = command.ExecuteReader();

            if (!reader.HasRows)
            {
                // Kriv unos korisničkog imena, poruka o grešci
            }
            reader.Read();
            // daj mi lozinku i sol
            string lozinka = reader["lozinka"].ToString();
            string sol     = reader["sol"].ToString();

            // Prvi hash
            string unesenaLozinka = Kripto.Hash(tb_llozinka.Text + sol);
            // Još jedan hash
            unesenaLozinka = Kripto.Hash(unesenaLozinka + sol);
            // samo za slučaj da su iste, idi dalje
            if (unesenaLozinka == lozinka)
            {
                Response.Redirect("Druga.aspx");
            }
        }
        catch (SqlException ex)
        {
            // Nešto napravi
        }
        finally // on se uvijek izvodi
        {
            // Zatvori konekciju
            connection.Close();
        }
    }
Beispiel #4
0
        public Kullanici SifirlamaCoz(string a, string b)
        {
            Kullanici k = new Kullanici();

            Kripto kripto = new Kripto();
            string eMail  = kripto.DESCoz(a);
            string sifre  = kripto.DESCoz(b);

            string hata = k.GirisKontrol(eMail, sifre, false);

            if (hata.Length > 1)
            {
                return(null);
            }
            else
            {
                return(k);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string LisansText = txtLisansKodu.Text;
                string lsc        = Kripto.RsaSifreCoz(LisansText);

                if (lsc != ComputerInfo.GetComputerId())
                {
                    MessageBox.Show("Geçersiz lisans kodu");
                }
                else
                {
                    File.WriteAllText("ls.lc", LisansText);
                    ilk_kurulum();
                    MessageBox.Show("İşlem başarılı. Yazılımı tekrar çalıştırarak kullanmaya başlayabilirsiniz");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Geçersiz lisans kodu" + ex.ToString());
            }
        }
Beispiel #6
0
        public string SifirlamaKey(string eMail)
        {
            DataTable dt = SQL.get("SELECT * FROM kullanicilar WHERE silindi = 0 AND eMail = '" + eMail + "'");

            if (dt.Rows.Count <= 0)
            {
                return("");
            }

            string siteUrl = string.Format("{0}://{1}{2}{3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port == 80 ? string.Empty : ":" + HttpContext.Current.Request.Url.Port, HttpContext.Current.Request.ApplicationPath);

            Kripto kripto = new Kripto();


            DataRow dr     = dt.Rows[0];
            string  url    = siteUrl + "/Home/RePass?a=" + kripto.DESSifrele(eMail) + "&b=" + kripto.DESSifrele(dr["sifre"].ToString());
            string  icerik =
                "<table style='width:100%!important;height:100%!important;line-height:100%!important;border-spacing:0;border-collapse:collapse;font-size:16px;margin:0;padding:0;border:0' cellspacing='0' cellpadding='0' border='0' align='center'>" +
                "   <tbody>" +
                "       <tr>" +
                "           <td valign='top' bgcolor='#FFFFFF' align='center'>" +
                "               <table width='720' style='border-spacing:0;border-collapse:collapse;width:100%;max-width:45em;margin-top:2em;margin-bottom:2em;border-color:#e0e0e0 #dddddd #dddddd;border-style:solid;border-width:0.0625em' cellspacing='0' cellpadding='0' border='0' bgcolor='#fff'>" +
                "                   <tbody>" +
                "                       <tr>" +
                "                           <td bgcolor='#ffffff' style='padding:0 5%'>" +
                "                               <table style='border-spacing:0;border-collapse:collapse;width:100%' cellspacing='0' cellpadding='0' border='0'>" +
                "                                   <tbody>" +
                "                                       <tr>" +
                "                                           <td align='left' style='width:9.125em;padding-top:2em;padding-bottom:1em'>" +
                "                                               <a href='" + siteUrl + "' target='_blank'>" +
                "                                                   <img src='" + siteUrl + "/Content/icerik/site_logo/" + Site.siteBilgileri.logo + "' style='outline:none;text-decoration:none;display:block' border='0'>" +
                "                                               </a>" +
                "                                           </td>" +
                "                                           <td align='center' valign='middle' style='padding-top:1em;padding-left:1em;padding-right:1em;font-size:16px'>" +
                "                                               <table width='100%' border='0' cellspacing='0' cellpadding='0'>" +
                "                                                   <tbody>" +
                "                                                        <tr>" +
                "                                                            <td width='100%' height='1' style='width:100%;height:1px;font-size:0;border-bottom-width:1px;border-bottom-color:#e5e5e5;border-bottom-style:solid;line-height:0'> &nbsp;</td>" +
                "                                                       </tr>" +
                "                                                   </tbody>" +
                "                                               </table>" +
                "                                           </td>" +
                "                                       </tr>" +
                "                                   </tbody>" +
                "                               </table>" +
                "                           </td>" +
                "                       </tr>" +
                "                       <tr>" +
                "                           <td bgcolor='#ffffff' style='padding:1em 5% 0'>" +
                "                               <table width='' border='0' cellspacing='0' cellpadding='0'>" +
                "                                   <tbody>" +
                "                                       <tr>" +
                "                                           <td style='font-family:Helvetica,Arial,sans-serif;font-size:15px;line-height:23px;color:#484848;max-width:656px;padding:0.2em 0 0'>" +
                "                                               Merhaba  <strong>" + dr["ad"] + " " + dr["soyad"] + "</strong>,<br><br>" +
                "                                               Şifrenizi unuttuysanız üzülmeyin, aşağıdaki butona basarak yeni şifre oluşturabilirsiniz." +
                "                                           </td>" +
                "                                       </tr>" +
                "                                       <tr>" +
                "                                           <td align='center' style='padding:2.5em 0 0'>" +
                "                                               <table width='100%' cellspacing='0' cellpadding='0' border='0'>" +
                "                                                   <tbody>" +
                "                                                       <tr>" +
                "                                                           <td align='left'>" +
                "                                                               <a href='" + url + "' style='background-color:rgba(40, 121, 254, 0.9);border-radius:4px;color:#ffffff;display:inline-block;font-family:'AvenirNext',Arial,Helvetica,sans-serif;font-size:15px;font-weight:bold;line-height:44px;text-align:center;text-decoration:none;width:224px' target='_blank'>Yeni Şifre Oluştur</a>" +
                "                                                           </td>" +
                "                                                       </tr>" +
                "                                                   </tbody>" +
                "                                               </table>" +
                "                                           </td>" +
                "                                       </tr>" +
                "                                   </tbody> " +
                "                               </table>" +
                "                           </td>" +
                "                       </tr>" +
                "                       <tr>" +
                "                           <td bgcolor='#ffffff' style='padding:3em 5% 0'>" +
                "                               <table cellspacing='0' cellpadding='0' border='0'>" +
                "                                   <tbody>" +
                "                                       <tr>" +
                "                                           <td width='24' align='left' valign='top'></td>" +
                "                                           <td valign='top' style='font-family:Helvetica,Arial,sans-serif;font-size:13px;color:#484848;line-height:17px;padding-top:1px'>" +
                "                                               <span style='color:rgba(40, 121, 254, 0.9);font-weight:bold'>Önemli Hatırlatma:</span><br><br>Eğer şifre yenileme talebinin size ait olmadığını düşünüyorsanız lütfen bu e-postayı dikkate almayın." +
                "                                               Mevcut şifreniz ile giriş yapmaya devam edebilirsiniz." +
                "                                           </td>" +
                "                                       </tr>" +
                "                                   </tbody>" +
                "                               </table>" +
                "                           </td>" +
                "                       </tr>" +
                "                       <tr>" +
                "                           <td bgcolor='#ffffff' style='padding:0 5% 1em'>" +
                "                               <table width='100%' cellspacing='0' cellpadding='0' border='0'>" +
                "                                   <tbody>" +
                "                                       <tr>" +
                "                                           <td align='left' style='font-family:Helvetica,Arial,sans-serif;font-size:15px;color:#484848;line-height:1.4'>" +
                "                                               <br><br>—<br><br>" +
                "                                               Teşekkür ederiz,<br>" +
                "                                               <strong>" + Site.siteBilgileri.siteAdi + "</strong>" +
                "                                           </td>" +
                "                                       </tr>" +
                "                                   </tbody>" +
                "                               </table>" +
                "                           </td>" +
                "                       </tr> " +
                "                   </tbody>" +
                "               </table>" +
                "           </td>" +
                "       </tr>" +
                "   </tbody>" +
                "</table>";

            Site.MailGonder("Şifre yenileme talebi", icerik, new List <string> {
                eMail
            });

            return("Mail Gönderildi");
        }