aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-03-02 15:38:33 -0600
committerJP Dillingham <jp@dillingham.me>2024-03-02 15:38:33 -0600
commit9393e973873d637f7c3776437cbeaddeae808d70 (patch)
tree10fc300c5d8a6836ead1d203d3e6d9551015f188
parent35b50db222665d4bb4caf9b2b565c9497891b50f (diff)
downloadslskd-9393e973873d637f7c3776437cbeaddeae808d70.tar.gz
remove warning if jwt key is fewer than 32 characters
-rw-r--r--src/slskd/Program.cs11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index ad50dccd..d7f6caca 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -634,16 +634,7 @@ namespace slskd
services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo(Path.Combine(DataDirectory, "misc", ".DataProtection-Keys")));
- var adjustedJwtKey = OptionsAtStartup.Web.Authentication.Jwt.Key;
-
- // the JWT key must be at least 256 bits in length, due to the HMACSHA256 algorithm being used for signing.
- if (adjustedJwtKey.Length < 32)
- {
- adjustedJwtKey = adjustedJwtKey.PadRight(32, ' ');
- Log.Warning("The configured JWT signing key is less than the required 32 characters and has been padded with spaces to make up the difference. The minimum length will be raised from 16 to 32 in a future release, and this will become an error.");
- }
-
- var jwtSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(adjustedJwtKey));
+ var jwtSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(OptionsAtStartup.Web.Authentication.Jwt.Key));
services.AddSingleton(jwtSigningKey);
services.AddSingleton<ISecurityService, SecurityService>();