Closed Derrick-Tan-Aquametro closed 8 months ago
I seem to have the the same problem with my .NET 6 WPF applications.
When running on a physical Win10 machine, everything is fine, but if I run the applications inside of a Win10 VirtualBox VM or the Windows Sandbox a PlatformNotSupportedException
is thrown as soon as any NSec functionality is used:
2023-08-17 12:59:45.6827 ERROR System.Exception System.PlatformNotSupportedException: Could not initialize platform-specific components. NSec may not be supported on this platform. See https://nsec.rocks/docs/install for more information.
EXCEPTION: System.PlatformNotSupportedException: Could not initialize platform-specific components. NSec may not be supported on this platform. See https://nsec.rocks/docs/install for more information.
---> System.DllNotFoundException: Unable to load DLL 'libsodium' or one of its dependencies: Das angegebene Modul wurde nicht gefunden. (0x8007007E)
at Interop.Libsodium.sodium_library_version_major()
at NSec.Cryptography.Sodium.InitializeCore()
--- End of inner exception stack trace ---
at NSec.Cryptography.Sodium.InitializeCore()
at NSec.Cryptography.Algorithm..ctor()
at NSec.Cryptography.HashAlgorithm..ctor(Int32 hashSize)
at NSec.Cryptography.Blake2b..ctor(Int32 hashSize)
at NSec.Cryptography.HashAlgorithm.get_Blake2b_256()
Edit: The VMs are running .NET Desktop Runtime 6.0.21. But after upgrading the physical machine from 6.0.19 to 6.0.21 it still works, so it's probably not an issue of the runtime.
The Visual C++ Redistributable is required on Windows. This is mentioned at the bottom of the NSec Installation page. You need the vcruntime DLL in the same directory as a self-contained application if the runtime hasn't been installed (see #67).
Thanks, I had overlooked that. It works after installing that.
It is quite easy to miss. @ektrah do you think it would be worth putting it in a highlighted Note section like the warning about nonce reuse for AEADs?
I have reworked the page a bit in 0eb608dd6908f4ed5ba6446a3f6b7ecb04e799a2. I hope that makes it more clear 😸
I am in windows 10.
All the libsodium.dll files is here:
But I am getting this error... It is after build, does it affect by Virtual Machine? I don't think so right...