dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.29k stars 4.74k forks source link

[wasm][tests] Use a polyfill for WebCrypto API support #42730

Closed kjpou1 closed 4 years ago

kjpou1 commented 4 years ago

Right now the System.Security.Cryptography tests uses a generic getRandomValues.

Microsoft provides a Web Cryptography polyfill API that can be used to provide the interface for testing within the CI.

Without a getRandomValues implementation the following is thrown in the CI.

ABORT: no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };
ghost commented 4 years ago

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @jeffhandley See info in area-owners.md if you want to be subscribed.