Set JWT.alg to PS256 with PssPadding. (#3789)

This commit is contained in:
Tingluo Huang
2025-04-07 11:49:14 -04:00
committed by GitHub
parent c1095ae2d1
commit aaf1b92847
2 changed files with 20 additions and 1 deletions

View File

@@ -25,7 +25,10 @@ namespace GitHub.Services.WebApi.Jwt
HS256,
[EnumMember]
RS256
RS256,
[EnumMember]
PS256,
}
//JsonWebToken is marked as DataContract so
@@ -286,6 +289,7 @@ namespace GitHub.Services.WebApi.Jwt
{
case JWTAlgorithm.HS256:
case JWTAlgorithm.RS256:
case JWTAlgorithm.PS256:
return signingCredentials.SignData(bytes);
default:

View File

@@ -166,6 +166,21 @@ namespace GitHub.Services.WebApi
}
}
public override JWTAlgorithm SignatureAlgorithm
{
get
{
if (m_signaturePadding == RSASignaturePadding.Pss)
{
return JWTAlgorithm.PS256;
}
else
{
return base.SignatureAlgorithm;
}
}
}
protected override Byte[] GetSignature(Byte[] input)
{
using (var rsa = m_factory())