Open knutwannheden opened 7 months ago
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones See info in area-owners.md if you want to be subscribed.
Author: | knutwannheden |
---|---|
Assignees: | - |
Labels: | `area-System.Security` |
Milestone: | - |
There's not a special wasi
build of System.Security.Cryptography. Is it not the same as browser
?
Based on the message, I think it's just pulling in the RID-less build; since that looks like the output from <GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetPlatformIdentifier)' == ''">SR.SystemSecurityCryptography_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
Is it not the same as browser?
It's not. We would need to treat $(NetCoreAppCurrent)-wasi
the same as browser
.
We would also need to go and annotate all of our UnsupportedOSPlatforms that have browser with "wasi", I think.
Correct, since wasi is still an experiemental platform we haven't annotated the apis for the analyzer yet. https://github.com/WebAssembly/WASI-crypto is the proposal we would wrap if we decide to add platform support.
Description
Currently, the
System.Security.Cryptography.HashAlgorithmName
methods throw aPlatformNotSupportedException
when executed in a C# program that got compiled against thewasi-wasm
runtime. While the WASI Crypto API hasn't been finalized (AFAICT) andwasmtime
doesn't provide any implementation, it would be really useful if at least the managed implementation of these crypto functions were available for programs running under wasi-wasm.Reproduction Steps
Compile any program accessing any of the crypto functions (e.g. SHA1). When run an exception will be thrown:
Expected behavior
While no WASI Crypto API has been finalized and made available via
wasmtime
, it would be really useful if the managed implementations could be used. I am trying to use Roslyn APIs, which internally use both SHA1 and SHA256 and thus cannot be executed under wasi-wasm.Actual behavior
A
PlatformNotSupportedException
gets thrown.Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response