Browse Source

Cleaning

master
Gregory Rudolph 3 years ago
parent
commit
7e545d5f1e
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 8
      Pages/Account.cshtml.cs
  2. 16
      SRP6.cs

8
Pages/Account.cshtml.cs

@ -1,9 +1,7 @@ @@ -1,9 +1,7 @@
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using MySql.Data.MySqlClient;
using System.Security.Cryptography;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
@ -19,7 +17,6 @@ namespace NightmareCoreWeb2.Pages @@ -19,7 +17,6 @@ namespace NightmareCoreWeb2.Pages
public bool IsGM { get; set; }
public bool IsAuthenticated = false;
public Account UserAccount { get; set; }
public List<Character> OnlineCharacters = new List<Character>();
public List<GMTicket> Tickets = new List<GMTicket>();
@ -28,8 +25,6 @@ namespace NightmareCoreWeb2.Pages @@ -28,8 +25,6 @@ namespace NightmareCoreWeb2.Pages
private MySqlConnection conn;
public AccountModel(ILogger<AccountModel> logger)
{
conn = new MySqlConnection(Program.connStr);
_logger = logger;
}
@ -47,6 +42,7 @@ namespace NightmareCoreWeb2.Pages @@ -47,6 +42,7 @@ namespace NightmareCoreWeb2.Pages
c.AtLogin |= (Character.AtLoginOptions)action;
}
c.SetAtLogin();
Response.Redirect("/Account");
}
public void OnGet()
@ -98,8 +94,6 @@ namespace NightmareCoreWeb2.Pages @@ -98,8 +94,6 @@ namespace NightmareCoreWeb2.Pages
this.UserAccount = a;
}
public void OnPostLogin()
{
UserEmail = Request.Form["UserEmail"];

16
SRP6.cs

@ -44,13 +44,6 @@ namespace Framework.Cryptography @@ -44,13 +44,6 @@ namespace Framework.Cryptography
var salt = new byte[0].GenerateRandomKey(32); // random salt
return (salt, CalculateVerifier(username, password, salt));
}
[Obsolete]
public static (byte[] Salt, byte[] Verifier) MakeRegistrationDataFromHash(byte[] hash)
{
var salt = new byte[0].GenerateRandomKey(32); // random salt
return (salt, CalculateVerifierFromHash(hash, salt));
}
public static byte[] CalculateVerifier(string username, string password, byte[] salt)
{
@ -64,14 +57,5 @@ namespace Framework.Cryptography @@ -64,14 +57,5 @@ namespace Framework.Cryptography
// v = BigInteger.ModPow(gBN, x, BN);
return BigInteger.ModPow(_g, new BigInteger(_sha1.ComputeHash(salt.Combine(hash)), true), _N).ToByteArray();
}
public static BigInteger CalculateBigIntVerifier(string username, string password, byte[] salt) {
byte[] hash = _sha1.ComputeHash(Encoding.UTF8.GetBytes(username.ToUpperInvariant() + ":" + password.ToUpperInvariant()));
return BigInteger.ModPow(_g, new BigInteger(_sha1.ComputeHash(salt.Combine(hash)), true), _N);
}
public static bool CheckLogin(string username, string password, byte[] salt, byte[] verifier)
{
return verifier.Compare(CalculateVerifier(username, password, salt));
}
}
}
Loading…
Cancel
Save