Hello,
Is RNGCryptoServiceProvider missing or has the name been changed? I
I use RNGCryptoServiceProvider to create random salts and ore security items. So I really need it.
Thank you,
Thomas
According to aspisof.net, RNGCryptoServiceProvider is not available in .Net Standard 1.x. It will exist in .Net Standard 2.0 though.
Is there a reason why you can't use RandomNumberGenerator instead, which exists in .Net Standard 1.3+?
The new API site https://docs.microsoft.com/en-us/dotnet/api/
RandomNumberGenerator.Create() is the preferred call over new RNGCryptoServiceProvider(), in both .NET Core and .NET Framework. It produces a RNGCryptoServiceProvider on .NET Framework (by default), and on .NET Core produces an opaque type which is based on BCryptGenRandom (Windows), or OpenSSL's random number generator (!Windows) (and in .NET Core 2.0 is based on CCRandomGenerateBytes for macOS).
https://stackoverflow.com/questions/38632735/rngcryptoserviceprovider-in-net-core/38644970#38644970
@bartonjs
The documentation for RandomNumberGenerator says:
Application code does not directly use this class. This abstract class is provided as the base class for all cryptographic random number generators.
For an implementation of a cryptographic random number generator, use the derived class
RNGCryptoServiceProvider.
Are you saying this does not reflect the preferred practice even on .Net Framework and should be updated?
@svick Yep. Good catch.
Most helpful comment
RandomNumberGenerator.Create()is the preferred call overnew RNGCryptoServiceProvider(), in both .NET Core and .NET Framework. It produces a RNGCryptoServiceProvider on .NET Framework (by default), and on .NET Core produces an opaque type which is based on BCryptGenRandom (Windows), or OpenSSL's random number generator (!Windows) (and in .NET Core 2.0 is based on CCRandomGenerateBytes for macOS).https://stackoverflow.com/questions/38632735/rngcryptoserviceprovider-in-net-core/38644970#38644970