Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSACryptoServiceProvider.ExportParameters hangs on BWA #36806

Closed
rkttu opened this issue May 21, 2020 · 6 comments
Closed

RSACryptoServiceProvider.ExportParameters hangs on BWA #36806

rkttu opened this issue May 21, 2020 · 6 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-System.Security
Milestone

Comments

@rkttu
Copy link

rkttu commented May 21, 2020

Describe the bug

I tested a code which relies on RSACryptoServiceProvider.ExportParameters function in Blazor WebAssembly, but it hangs after the function called.

To Reproduce

I tested the below code in the SDK 3.1.300 (3.1.4 release).

private RSACryptoServiceProvider csp;
...
this.csp = new RSACryptoServiceProvider(keySize);
...
var parameters = csp.ExportParameters(true); // This line causes hang.
var parameters = csp.ExportParameters(false); // This line also causes hang.

Further technical details

  • ASP.NET Core version: 3.2.0
  • Include the output of dotnet --info
.NET Core SDK(global.json 반영):
 Version:   3.1.300
 Commit:    b2475c1295

런타임 환경:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.300\

Host (useful for support):
  Version: 3.1.4
  Commit:  0c2e69caa6

.NET Core SDKs installed:
  2.1.607 [C:\Program Files\dotnet\sdk]
  3.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version: Visual Studio 2019 v16.6.0, Windows 10 x64 19041.264, Microsoft Edge Stable Channel v81.0.416.77 x64
@davidfowl davidfowl transferred this issue from dotnet/aspnetcore May 21, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Security untriaged New issue has not been triaged by the area owner labels May 21, 2020
@ghost
Copy link

ghost commented May 21, 2020

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq
Notify danmosemsft if you want to be subscribed.

@davidfowl
Copy link
Member

Likely a mono issue?

@shawnshaddock
Copy link

I'm having an issue with ExportParameters(true) as well. It takes an extremely long time to return, and when it finally does return the private parameters aren't there. Only Exponent and Modulus are populated.

@bartonjs bartonjs added the arch-wasm WebAssembly architecture label Jun 15, 2020
@marek-safar marek-safar added this to the 5.0.0 milestone Jun 24, 2020
@marek-safar marek-safar removed the untriaged New issue has not been triaged by the area owner label Jun 24, 2020
@mdh1418
Copy link
Member

mdh1418 commented Jun 30, 2020

Blazor WebAssembly in .NET 5 does not support cryptography libraries. It will throw System.PlatformNotSupportedException: System.Security.Cryptography is not supported on Browser.

@mdh1418 mdh1418 closed this as completed Jun 30, 2020
@rkttu
Copy link
Author

rkttu commented Jun 30, 2020

@davidfowl @mdh1418 Thanks for your comment. I understand that local cryptography in Blazor is a corner and rare use case. Also, it requires lots of computing resources. But I didn't find any notice or best practices about cryptographic API that does not support Blazor. This situation makes some confusion. If possible, even in the current version, this API should also throw the exception to prevent further trouble.

@rkttu
Copy link
Author

rkttu commented Jun 30, 2020

For those of you interested in this topic, there is one piece of information I found.
I found an alternative implementation. It will be an alternative implementation of built-in local cryptography.

https://github.com/ebekker/FMRL/tree/master/BlazorX.WebCrypto

BlazorExtensions/Home#1

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Security
Projects
None yet
Development

No branches or pull requests

7 participants