Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use the Argon2 Password Hashing method. I googled it and found that it requires libsodium.dll and so downloaded the zip file of libsodium.dll from github, which is below
https://github.com/adamcaudill/libsodium-net/releases

And tried to add the libsodium.dll to my project, it threw this error.
Error: A reference to 'C:\libsodium-net.v0.9.0\libsodium.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM Component.


I was trying to figure out how to use libsodium and Argon2 for password hashing and how to resolve the error when adding the libsodium.dll to my project. Please suggest!!!

What I have tried:

I installed 'libsodium for .NET 0.9.0' from NuGet packages, it added sodium.dll, but it doesn't have the Argon method that I was looking for.

I am trying to find a way to solve this, and I found this,
https://paragonie.com/blog/2016/02/how-safely-store-password-in-2016

Thought it would be helpful for me if I add the libsodium.dll. Tried with hasing method for C#.Net from that URL, but it was throwing error at ArgonHashString method.

var hash = PasswordHash.ArgonHashString(yourPasswordString, Strength.Interactive)
if (PasswordHash.ArgonHashStringVerify(hash, yourPasswordString) {
//correct password
}

I tried to add the reference by copying the libsodium.dll to the bin of my project and by copying the dll yo C:\Program Files\Reference Assemblies\Microsoft\VSTO40\v10.0. It threw the same error. I tried to add the libsodium.dll by moving it to different folders. Tested by adding other dlls to my project and there is no issue when adding other dlls.
Posted
Updated 7-Jul-16 10:19am
v2

1 solution

Check the DLL carefully - the error is basically saying "this isn't an Assembly" which means it's a native DLL instead.
You can't reference a native DLL, only .NET an assemblies which are also helps if files with a DLL extension.
Native files have to be accessed via PInvoke instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900