Skip to content
Andrew Lambert edited this page Jan 12, 2017 · 31 revisions

##Introduction libsodium is a cross-platform fork of the NaCl cryptographic library. It provides secret-key and public-key encryption (XSalsa20), message authentication (Poly1305), digital signatures (Ed25519), key exchange (X25519), generic hashing (BLAKE2b), password hashing and key derivation (scrypt or Argon2), in addition to facilities for secure memory allocations and constant-time string comparisons.

RB-libsodium is a libsodium binding for Realbasic and Xojo ("classic" framework) projects. It is designed and tested using REALstudio 2011r4.3 on Windows 7. Library binaries for a number of platforms are available, or can built from source.

##Example This example generates and validates a password hash that is suitable to be stored in a database:

  Dim pw As libsodium.Password = "seekrit"
  Dim hash As String = pw.GenerateHash()
  If Not pw.VerifyHash(hash) Then MsgBox("Bad password!")

##Hilights

##Synopsis RB-libsodium is designed to make it as hard as possible to write bad crypto code. For example signing keys can't be used to perform encryption, so methods that need a signing key will require an instance of the SigningKey class as a parameter; attempting to pass an EncryptionKey will generate a compiler error.

##How to incorporate libsodium into your Realbasic/Xojo project ###Import the libsodium module

  1. Download the RB-libsodium project either in ZIP archive format or by cloning the repository with your Git client.
  2. Open the RB-libsodium project in REALstudio or Xojo. Open your project in a separate window.
  3. Copy the libsodium module into your project and save.

###Ensure the libsodium shared library is installed libsodium is not ordinarily installed by default on most operating systems, you will need to ship necessary DLL/SO/DyLibs with your application. You can use pre-built binaries available here, or you can build them yourself from source.

RB-libsodium will raise a PlatformNotSupportedException when used if all required DLLs/SOs/DyLibs are not available at runtime.

##Examples

Clone this wiki locally