-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
HKDF: inconsistency regarding output key material of zero length #42230
Comments
Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @jeffhandley |
Marking this initially as 5.0 since this shipped this release and it would be a breaking change to go from no throw -> throw. I don't feel strongly opinionated if we should throw or not. This operation with length 0 doesn't make much sense. Can't think of scenario where it would make sense to want zero length key. Perhaps we should always throw? @bartonjs any thoughts? |
Apparently there are two of these, this one for zero and the other for negative... and I answered on the other. I don't see any way where zero makes sense; we should throw AOORE for any length < 1. (Yeah, we can make it be no-op/Array.Empty, but it's not providing value) |
I did a preemptive bar check on this and determined it won't meet the bar for 5.0.0 (since there are workarounds); moving to 6.0.0. Thanks for reporting this, @andreimilto! |
I was happy to help, @jeffhandley! |
I unassigned myself from both bugs and will pick this up somewhere in 6.0 timeline |
@krwq This and the other one would make a good [up-for-grabs] and [easy] tags if you wouldn't mind someone from the community picking these up. |
Note to anyone picking this up: it probably makes sense to fix #42229 in the same pull request. |
Thank you @tonycimaglia! |
I'll also be picking this one up with #42229 Since there hasn't been any action in around 8 months |
There's an inconsistency in the way methods of the
System.Security.Cryptography.HKDF
class treat a request to derive an output key material (OKM) of zero length: one method throws and the other three methods work ok.Example:
Instead there should be a clear policy on whether a request to derive an OKM of zero length is considered valid or not:
byte
overload ofExpand
should be fixed to return an empty byte array instead of throwing an exception)Windows 10 x64 Pro, dotnet 5.0.0-preview.8.
The text was updated successfully, but these errors were encountered: