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

Rfc2898DeriveBytes Class Microsoft Learn Page #9657

Open
vsfeedback opened this issue Feb 28, 2024 · 2 comments · May be fixed by #9545
Open

Rfc2898DeriveBytes Class Microsoft Learn Page #9657

vsfeedback opened this issue Feb 28, 2024 · 2 comments · May be fixed by #9545
Labels
area-System.Security Issues related to security practices for .NET developers. Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner

Comments

@vsfeedback
Copy link

vsfeedback commented Feb 28, 2024

This issue has been moved from a ticket on Developer Community.


Hello,

I think there's a bug in the example code. When I copy/paste the code to test it, I receive an exception with the message, "Padding is invalid and cannot be removed".

There is a comment in the code example that says, "//The default iteration count is 1000 so the two methods use the same iteration count." The code however does not reflect this. On the line "Rfc2898DeriveBytes k2 = new Rfc2898DeriveBytes(pwd1, salt1);", it is missing ",
myIterations" as the preceding line has. This generates unique keys preventing decryption; reading elsewhere I found that the Keys and IVs must match on both encryption and decryption. Adding myIterations to this line fixes my issue.

Also, later down the page it says the constructors supplied in the example implementation for Rfc2898DeriveBytes are obsolete and should have the hash algorithm name.

Thanks!


Original Comments

Tracy Wang [MSFT] on 12/25/2023, 00:46 AM:

(private comment, text removed)

M Aseel Tungekar on 1/5/2024, 11:33 AM:

(private comment, text removed)

Feedback Bot on 1/2/2024, 09:31 PM:

(private comment, text removed)

Feedback Bot on 1/7/2024, 05:32 PM:

(private comment, text removed)

Tomas Weinfurt [MSFT] on 1/15/2024, 08:07 PM:

I opened #9545 to update docs.


@dotnet-issue-labeler dotnet-issue-labeler bot added the area-System.Security Issues related to security practices for .NET developers. label Feb 28, 2024
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Feb 28, 2024
@ghost
Copy link

ghost commented Feb 28, 2024

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

This issue has been moved from a ticket on Developer Community.


Hello,

I think there's a bug in the example code. When I copy/paste the code to test it, I receive an exception with the message, "Padding is invalid and cannot be removed".

There is a comment in the code example that says, "//The default iteration count is 1000 so the two methods use the same iteration count." The code however does not reflect this. On the line "Rfc2898DeriveBytes k2 = new Rfc2898DeriveBytes(pwd1, salt1);", it is missing ",
myIterations" as the preceding line has. This generates unique keys preventing decryption; reading elsewhere I found that the Keys and IVs must match on both encryption and decryption. Adding myIterations to this line fixes my issue.

Also, later down the page it says the constructors supplied in the example implementation for Rfc2898DeriveBytes are obsolete and should have the hash algorithm name.

Thanks!


Original Comments

Tracy Wang [MSFT] on 12/25/2023, 00:46 AM:

(private comment, text removed)

M Aseel Tungekar on 1/5/2024, 11:33 AM:

(private comment, text removed)

Feedback Bot on 1/2/2024, 09:31 PM:

(private comment, text removed)

Feedback Bot on 1/7/2024, 05:32 PM:

(private comment, text removed)

Tomas Weinfurt [MSFT] on 1/15/2024, 08:07 PM:

(private comment, text removed)


Original Solutions

(no solutions)

Author: vsfeedback
Assignees: -
Labels:

area-System.Security, untriaged

Milestone: -

@buyaa-n buyaa-n transferred this issue from dotnet/runtime Feb 28, 2024
@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Feb 28, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

@buyaa-n buyaa-n linked a pull request Feb 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Security Issues related to security practices for .NET developers. Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant