Random numbers for Windows Phone 8 and Windows Store 8?

☆樱花仙子☆ 提交于 2019-12-31 07:04:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!