Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Make Argon2id dynamic using SRP salt (#43)

Leendert de Borst9412f862eb8b
diff --git a/src/Utilities/Cryptography/Encryption.cs b/src/Utilities/Cryptography/Encryption.cs
index f0c0b3bd0..05b1e65f4 100644
--- a/src/Utilities/Cryptography/Encryption.cs
+++ b/src/Utilities/Cryptography/Encryption.cs
@@ -44,7 +44,7 @@ public static class Encryption
/// <param name="password">User password.</param>
/// <param name="salt">The salt to use for the Argon2id hash.</param>
/// <returns>Encryption key as byte array.</returns>
- public static async Task<byte[]> DeriveKeyFromPasswordAsync(string password, string salt = "AliasVault")
+ public static async Task<byte[]> DeriveKeyFromPasswordAsync(string password, string salt)
{
byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
byte[] saltBytes = Encoding.UTF8.GetBytes(salt);
diff --git a/src/Utilities/Cryptography/Srp.cs b/src/Utilities/Cryptography/Srp.cs
index e84667180..e6d8b3962 100644
--- a/src/Utilities/Cryptography/Srp.cs
+++ b/src/Utilities/Cryptography/Srp.cs
@@ -46,7 +46,7 @@ public class Srp
public static async Task<string> DerivePrivateKey(string salt, string email, string plaintextPassword)
{
var client = new SrpClient();
- byte[] passwordHash = await Encryption.DeriveKeyFromPasswordAsync(plaintextPassword);
+ byte[] passwordHash = await Encryption.DeriveKeyFromPasswordAsync(plaintextPassword, salt);
var passwordHashString = BitConverter.ToString(passwordHash).Replace("-", string.Empty);
return client.DerivePrivateKey(salt, email, passwordHashString);
}