System.Security.Cryptography API は、ブラウザ上で実行されるとランタイム時に PlatformNotSupportedException をスローします。
変更の説明
以前の .NET バージョンでは、 System.Security.Cryptography API のほとんどは Blazor WebAssembly アプリでは使用できません。 .NET 5 以降、Blazor WebAssembly アプリは完全な .NET 5 API サーフェス領域を対象としますが、ブラウザーサンドボックスの制約のためにすべての .NET 5 API がサポートされているわけではありません。 .NET 5 以降のバージョンでは、サポートされていない System.Security.Cryptography API は、WebAssembly で実行するときに PlatformNotSupportedException をスローします。
ヒント
プラットフォーム互換性アナライザーは、ブラウザー プラットフォームをサポートするプロジェクトをビルドするときに、影響を受ける API への呼び出しにフラグを設定します。 このアナライザーは、.NET 5 以降のアプリで既定で実行されます。
変更の理由
Microsoft は、Blazor WebAssembly 構成の依存関係として OpenSSL を出荷できません。 この問題を回避するために、ブラウザーの SubtleCrypto API と統合しようとしました。 残念ながら、API を大幅に変更する必要があるため、統合が困難でした。
導入されたバージョン
5.0
推奨されるアクション
現時点では、推奨する適切な回避策はありません。
影響を受ける API
次を除くすべての System.Security.Cryptography API:
System.Security.Cryptography.RandomNumberGeneratorSystem.Security.Cryptography.IncrementalHashSystem.Security.Cryptography.SHA1System.Security.Cryptography.SHA256System.Security.Cryptography.SHA384System.Security.Cryptography.SHA512System.Security.Cryptography.SHA1ManagedSystem.Security.Cryptography.SHA256ManagedSystem.Security.Cryptography.SHA384ManagedSystem.Security.Cryptography.SHA512Managed
.NET