-
Notifications
You must be signed in to change notification settings - Fork 462
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
Modify RS256Algorithm to use RSA from cert directly #127
Conversation
@nbarbettini can you please check whether I upgraded target framework properly? I'm asking because AppVeyor fails |
@StefH can you please help with test, and what's more important with proper unit testing? |
0] Testing can be done like: 1] Generate certificate and private key openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate_pub.crt 2] 3] 4] 5] 6] |
src/JWT/JWT.csproj
Outdated
@@ -3,10 +3,9 @@ | |||
<PropertyGroup> | |||
<TargetFrameworks>net35;netstandard1.3</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line needs to be net462;netstandard1.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
src/JWT/JWT.csproj
Outdated
<FrameworkPathOverride>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride> | ||
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'"> | ||
<TargetFramework>net462</TargetFramework> | ||
<DefineConstants>NET46</DefineConstants> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any #if
directives that look for either NET35
or NET46
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, only 1 places (this file) that looks for NET_STANDARD. Good point thought!
Adding netstandard1.3 back
@ubercow sorry, it took some time to come back to the issue you're opened. Can you please take a look on this project? Should be same. |
@StefH right but I meant some input how to update existing/add new unit test(s). Can you please help here? |
AppVeyor can't build anything:
I question its stability :( |
That doesn't seem like a typical error - can you try restarting the build? |
It fails with same error for a while now: https://ci.appveyor.com/project/abatishchev/jwt/history |
src/JWT/Algorithms/RS256Algorithm.cs
Outdated
#if NETSTANDARD1_3 | ||
var rsa = (RSACryptoServiceProvider)_cert.GetRSAPrivateKey(); | ||
return (RSA)cert.GetRSAPrivateKey(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why casting to RSA ? This is not needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, thanks!
src/JWT/JWT.csproj
Outdated
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier> | ||
<DefineConstants>NET35</DefineConstants> | ||
<FrameworkPathOverride>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride> | ||
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not used because you only define <TargetFrameworks>net35;netstandard1.3</TargetFrameworks>
.
So just revert back this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I want to upgrade to net462. What would be the right way to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just add net462 like:
<TargetFrameworks>net35;net462;netstandard1.3</TargetFrameworks>
.
But this is not needed because the net35 can be used by all frameworks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it's this:
<TargetFrameworks>net462;netstandard1.3</TargetFrameworks>
Isn't this correct?
@abatishchev |
Usually we test end-to-end by having hard-coded JWT and asserting expected outcome |
If the build works fine, and all code is merged to master branch, I will take a quick look how to do unit test. |
@nbarbettini please take a look to the latest changes |
I'm not super familiar with the RSACryptoServiceProvider stuff, but it looks reasonable. Are you intending to raise the minimum framework version to .NET 4.6.2? |
Yeah, I'm not either :) Hope it works, and now works better. Yes, to normalize the code between .NetFramework and .Net Core. Hope everybody will be fine with that too. |
If possible, can you lower the dependency for 4.6.2? Can you lower this to .net 4.0? In that way your librabry can also be used by .net 4 and .net 4.5 libraries/programs. |
Let's continue in #130. Can you please describe your scenario/environment/requirements? The thing from my perspective is that 4.6.2 is the lowest supported as of today version, all lower are out of support. And transition from 4.0 to 4.5. would be long due, and from 4.5 to 4.6.2 usually is seamless. But again I'd love to understand your perspective. |
Resolves #124, closes #118.
Drawback:
RSA
doesn't have methodSignData
in .NET 3.5, so I upgraded to .NET 4.6.2