Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Parameters checking in the RS256Algorithm's constructor #209

Merged
merged 3 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/JWT/Algorithms/RS256Algorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public sealed class RS256Algorithm : IJwtAlgorithm
/// <param name="privateKey">The RSA key for signing the data.</param>
public RS256Algorithm(RSACryptoServiceProvider publicKey, RSA privateKey)
{
_publicKey = publicKey ?? throw new InvalidOperationException("Private key is null");
_privateKey = privateKey ?? throw new InvalidOperationException("Public key is null");
_publicKey = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
_privateKey = privateKey ?? throw new ArgumentNullException(nameof(privateKey));
}

/// <summary>
Expand All @@ -29,7 +29,7 @@ public RS256Algorithm(RSACryptoServiceProvider publicKey, RSA privateKey)
/// <param name="publicKey">The RSA service provider for verifying the data.</param>
public RS256Algorithm(RSACryptoServiceProvider publicKey)
{
_publicKey = publicKey ?? throw new InvalidOperationException("Private key is null");
_publicKey = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
}

/// <summary>
Expand Down Expand Up @@ -91,4 +91,4 @@ private static RSACryptoServiceProvider GetPublicKey(X509Certificate2 cert)
return (RSACryptoServiceProvider)alg;
}
}
}
}
abatishchev marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/JWT/JWT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageProjectUrl>https://github.com/jwt-dotnet/jwt</PackageProjectUrl>
<Authors>Alexander Batishchev, John Sheehan, Michael Lehenbauer</Authors>
<PackageLicenseUrl>https://creativecommons.org/publicdomain/zero/1.0/</PackageLicenseUrl>
<Version>5.2.1</Version>
<Version>5.2.2</Version>
<PackageTags>jwt json</PackageTags>
<FileVersion>5.0.0.0</FileVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
Expand Down