Windows Phone 8 和 Windows Store 8 的随机数? [英] Random numbers for Windows Phone 8 and Windows Store 8?

查看:19
本文介绍了Windows Phone 8 和 Windows Store 8 的随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将几个安全库移植到 Windows Phone 8 和 Windows Store 8 平台.我需要一个提供随机数的函数.

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 有 CryptGenRandom 甚至 RtlGenRandom.Windows 应用商店 10 和通用 Windows 具有 BCryptGenRandom.但是,Windows Phone 8 和 Windows Store 8 存在漏洞,因为 CryptoAPI 可用,而 CNG 在 Windows 10 和通用 Windows 上可用.MSDN 文档说 BCryptGenRandom 可用于Windows Store",但他们没有说它的 Windows Store 10 和 UWP (感谢 CW).

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).

库是非托管的 C/C++.它们是用标准/可移植 C 和 C++ 编写的.有时,他们必须使用特定于操作系统的 API,例如用于收集随机数的 API.它们不针对托管 API 进行编译,也不链接到托管库.

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.

我们对 Windows Phone 8 和 Windows Store 8 的随机数使用什么?

What do we use for random numbers for Windows Phone 8 and Windows Store 8?

推荐答案

在 WP8.1 和 Windows 8+ 中,我们使用 CryptographicBuffer.GenerateRandomNumber

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

这篇关于Windows Phone 8 和 Windows Store 8 的随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆