Closed michielpost closed 3 years ago
Absolutely. It used to. But, it looks like now not only web marks a webassembly build but also browser. I'll try to get that in there soon but on my current branch, I mucked up the source playing with getting it to work on a Hololens (still a work in progress).
As a workaround for webassembly, you can create your own Argon2Config
and set the SecureArrayCall
field to an instance of DefaultWebSecureArrayCall
. Then use that Argon2Config
in calls to hash and verify.
Thanks for your help.
I did some more testing, it works fine with the SecureArray.DefaultCall
with Blazor WebAssembly on .Net Core 3.1
The error occures when the target is Blazor WebAssembly with .Net 5.0.
I tried the DefaultWebSecureArrayCall
workaround:
var result = Blake2B.ComputeHash(new byte[1] { 1 }, new DefaultWebSecureArrayCall());
But it still gives me an error:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Running on "Browser", not "web".
System.DllNotFoundException: Running on "Browser", not "web".
at Isopoh.Cryptography.SecureArray.DefaultWebSecureArrayCall..ctor()
I did some more investigation, and RuntimeInformation.OSDescription
now results in the value Browser
Changing the first if statement in the constructor of 'DefaultWebSecureArrayCall' to this, fixes it:
if (RuntimeInformation.OSDescription != "web" && RuntimeInformation.OSDescription != "Browser")
I'll submit a PR!
Any indication on when I can find the new version with this fix on NuGet? Thanks a lot!
Version 1.1.10 nuget packages now posted to https://www.nuget.org/packages/Isopoh.Cryptography.Argon2/, nuget.org/packages/Isopoh.Cryptography.Blake2b/, and, most importantly, https://www.nuget.org/packages/Isopoh.Cryptography.SecureArray/
I'm using this library with a new .net 5 Blazor webassembly project.
But i get the following error when calling
ComputeHash
:System.NotSupportedException: No SecureArray.DefaultCall support for current operating system (whatever that is, maybe "Browser", I think I know Windows, Linux, OSX, and web - and maybe iOS...). You don't have to use the default SecureArrayCall - you can pass in a version of the calls that work for your operating system.
Is it possible to use this with Blazor Webassembly?