问题
I'm struggling with a port of a couple of security libraries to the Windows Phone 8 and Windows Store 8 platform. I need a function which provides random numbers.
Win32 has CryptGenRandom
and even RtlGenRandom
. Windows Store 10 and Universal Windows has BCryptGenRandom
. However, there's a hole for Windows Phone 8 and Windows Store 8 because CryptoAPI is not available, and CNG is only available on Windows 10 and Universal Windows. The MSDN docs say BCryptGenRandom
is available for "Windows Store", but they don't say its Windows Store 10 and UWP (thanks CW).
The libraries are unmanaged C/C++. They are written in standard/portable C and C++. On occasion, they have to use a OS specific API like those for gathering random number. They don't compile against managed APIs, and they don't link to managed libraries.
What do we use for random numbers for Windows Phone 8 and Windows Store 8?
回答1:
In WP8.1 and Windows 8+ we are using CryptographicBuffer.GenerateRandomNumber
来源:https://stackoverflow.com/questions/36974545/random-numbers-for-windows-phone-8-and-windows-store-8