Random numbers for Windows Phone 8 and Windows Sto

2020-05-06 08:41发布

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条回答
▲ chillily
2楼-- · 2020-05-06 09:31

In WP8.1 and Windows 8+ we are using CryptographicBuffer.GenerateRandomNumber

查看更多
登录 后发表回答