Skip to content

Commit

Permalink
Remove if that targets all supported .Net versions (#2673)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLozensky authored Jun 28, 2024
1 parent 279ae11 commit bd81097
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/Microsoft.IdentityModel.Tokens/RsaSecurityKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,7 @@ public override bool HasPrivateKey
{
// imitate signing
byte[] hash = new byte[20];
#if NET462 || NET472 || NETSTANDARD2_0 || NET6_0_OR_GREATER
Rsa.SignData(hash, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
#else
if (Rsa is RSACryptoServiceProvider rsaCryptoServiceProvider)
rsaCryptoServiceProvider.SignData(hash, SecurityAlgorithms.Sha256);
else
Rsa.DecryptValue(hash);
#endif
_hasPrivateKey = true;
}
catch (CryptographicException)
Expand Down

0 comments on commit bd81097

Please sign in to comment.