Skip to content

Crypto support in wasi-wasm runtime #99126

Description

@knutwannheden

Description

Currently, the System.Security.Cryptography.HashAlgorithmName methods throw a PlatformNotSupportedException when executed in a C# program that got compiled against the wasi-wasm runtime. While the WASI Crypto API hasn't been finalized (AFAICT) and wasmtime 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:

System.PlatformNotSupportedException: SystemSecurityCryptography_PlatformNotSupported
   at System.Security.Cryptography.SHA1.Create()
   ...

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

  • .NET 9 (preview 1)
  • wasi-wasm runtime platform

Other information

No response

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions