INNER CODE UNIT · C#
ThrowNewCryptographicException
sdrapkin/SecurityDriven.Inferno · CryptoRandom.cs:398
static void ThrowNewCryptographicException(string message) => throw new CryptographicException(message);
static void ThrowNewArgumentOutOfRangeException(string paramName) => throw new ArgumentOutOfRangeException(paramName);
}//class CryptoRandom
#region BCrypt
// https://github.com/dotnet/corefx/blob/879182b657e7d18117c6d537b85c92841618b119/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs
internal static class BCrypt
{
const string bcrypt_dll = "bcrypt.dll";
const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002; // https://msdn.microsoft.com/en-us/library/windows/desktop/aa375458.aspx
// https://msdn.microsoft.com/en-ca/library/cc704588.aspx
internal enum NTSTATUS : uint { STATUS_SUCCESS = 0x0 } // and many other "failure" statuses we have no need to differentiate
static readonly bool s_isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
static readonly RandomNumberGenerator s_rng = RandomNumberGenerator.Create();