コード例 #1
0
        /// <summary>
        /// Create a new account with the supplied email and password, the password will have a verifier generated that is inserted into the database.
        /// </summary>
        public static void CreateAccount(string email, string password)
        {
            using (var context = new AuthContext())
            {
                byte[] s = RandomProvider.GetBytes(16u);
                byte[] v = Srp6Provider.GenerateVerifier(s, email, password);

                context.Account.Add(new Account
                {
                    Email = email,
                    S     = s.ToHexString(),
                    V     = v.ToHexString()
                });

                context.SaveChanges();
            }
        }
コード例 #2
0
 /// <summary>
 /// Returns a random salt and SRP6 password verifier for supplied email and plaintext password.
 /// </summary>
 public static (string salt, string verifier) GenerateSaltAndVerifier(string email, string password)
 {
     byte[] s = RandomProvider.GetBytes(16u);
     byte[] v = Srp6Provider.GenerateVerifier(s, email, password);
     return(s.ToHexString(), v.ToHexString());
 }