aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Program.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-03-02 16:21:06 -0600
committerGitHub <noreply@github.com>2024-03-02 16:21:06 -0600
commitb98bd9a523680a93164754ef31250f97787775fc (patch)
tree10fc300c5d8a6836ead1d203d3e6d9551015f188 /src/slskd/Program.cs
parent9b2269a5501fd6b971473f6dd08e632f1ee5238d (diff)
parent9393e973873d637f7c3776437cbeaddeae808d70 (diff)
downloadslskd-b98bd9a523680a93164754ef31250f97787775fc.tar.gz
Merge pull request #1090 from slskd/deprecate
Raise lower limit for JWT signing key from 16 to 32 characters
Diffstat (limited to 'src/slskd/Program.cs')
-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>();