Geralt
  • Introduction
  • Random data
  • Constant time
  • Secure memory
  • Encoding
  • Padding
  • Hashing
  • Message authentication
  • Password hashing
  • Key derivation
  • Authenticated encryption
    • Stream and file encryption
    • AEGIS-128L
    • AEGIS-256
    • ChaCha20-Poly1305
    • XChaCha20-Poly1305
  • Key exchange
  • Digital signatures
  • Advanced
    • Validation
    • Concat
    • ChaCha20
    • XChaCha20
    • HChaCha20
    • Poly1305
    • Ed25519 to X25519
Powered by GitBook
On this page

Getting libsodium to work on Windows

Last updated 9 months ago

libsodium requires the on Windows. This dependency is included in the .NET SDK. When publishing software, there are three ways to deal with this:

  1. Install this as part of your application setup/as a .

  2. Ask the user to manually install this.

  3. Bundle the vcruntime140.dll file with your executable.

If you want your program to be portable (e.g. ), you have to take the third approach. This can be done using the following steps:

  1. Download the VisualCppRedist_AIO_x86_x64.exe file from the of GitHub repo.

  2. Use to extract the downloaded executable (e.g. right click, hover over 7-Zip, and click Extract to "VisualCppRedist_AIO_x86_x64\").

  3. In the extracted folder, navigate to 2022, x86 and/or x64 (depending on which platform your application targets), System or System64, and copy the vcruntime140.dll file(s) to your project folder.

  4. Add the vcruntime140.dll file(s) as in your project.

  5. Write some code that extracts the relevant (x86 or x64) file to the or to the when your application starts.

  6. Test that libsodium in your application works/doesn't throw a PlatformNotSupportedException on a Windows machine that doesn't have the Visual C++ Redistributable installed (e.g. in or a ).

Visual C++ Redistributable for Visual Studio 2015-2022
package manager dependency
self-contained
latest release
this
7-Zip
embedded resources
location of your executable
directory where the libsodium.dll file is located
Windows Sandbox
virtual machine