dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
702 stars 1.55k forks source link

Update Rfc2898DeriveBytes Example Code #10011

Open StefanGreve opened 3 months ago

StefanGreve commented 3 months ago

The example code for the Rfc2898DeriveBytes class uses the RNGCryptoServiceProvider for creating random bytes, but the documentation also states that

RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead.

Since this part of the documentation is related to cryptographic code, an effort should be made to keep the examples in the documentation up-to-date, since many developers might just copy and paste these code snippets.

The obsoletion warning for RNGCryptoServiceProvider only applies to .NET, so I am not sure if this would also affect the .NET framework / standard documentation as well.

dotnet-policy-service[bot] commented 3 months ago

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones