All Projects → RubyCrypto → Rbnacl

RubyCrypto / Rbnacl

Licence: mit
Ruby FFI binding to the Networking and Cryptography (NaCl) library (a.k.a. libsodium)

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Rbnacl

Nsec
A modern and easy-to-use cryptographic library for .NET Core based on libsodium
Stars: ✭ 217 (-76.15%)
Mutual labels:  cryptography, libsodium, ed25519
Halite
High-level cryptography interface powered by libsodium
Stars: ✭ 933 (+2.53%)
Mutual labels:  cryptography, libsodium, ed25519
Sodium compat
Pure PHP polyfill for ext/sodium
Stars: ✭ 736 (-19.12%)
Mutual labels:  cryptography, libsodium, ed25519
rawr-x3dh
TypeScript Implementation of X3DH
Stars: ✭ 51 (-94.4%)
Mutual labels:  libsodium, ed25519
Pgsodium
Modern cryptography for PostgreSQL using libsodium.
Stars: ✭ 202 (-77.8%)
Mutual labels:  cryptography, libsodium
sodalite
tweetnacl in rust
Stars: ✭ 26 (-97.14%)
Mutual labels:  libsodium, ed25519
Libsodium Jni
(Android) Networking and Cryptography Library (NaCL) JNI binding. JNI is utilized for fastest access to native code. Accessible either in Android or Java application. Uses SWIG to generate Java JNI bindings. SWIG definitions are extensible to other languages.
Stars: ✭ 157 (-82.75%)
Mutual labels:  cryptography, libsodium
Swift Sodium
Safe and easy to use crypto for iOS and macOS
Stars: ✭ 400 (-56.04%)
Mutual labels:  cryptography, libsodium
Sapient
Secure API Toolkit
Stars: ✭ 308 (-66.15%)
Mutual labels:  cryptography, libsodium
Circl
CIRCL: Cloudflare Interoperable Reusable Cryptographic Library
Stars: ✭ 474 (-47.91%)
Mutual labels:  cryptography, ed25519
Sodiumoxide
Sodium Oxide: Fast cryptographic library for Rust (bindings to libsodium)
Stars: ✭ 596 (-34.51%)
Mutual labels:  cryptography, libsodium
Libsodium.js
libsodium compiled to Webassembly and pure JavaScript, with convenient wrappers.
Stars: ✭ 665 (-26.92%)
Mutual labels:  cryptography, libsodium
Kalium
Java binding to the Networking and Cryptography (NaCl) library with the awesomeness of libsodium
Stars: ✭ 203 (-77.69%)
Mutual labels:  cryptography, libsodium
Kryptor
A simple, modern, and secure encryption and signing tool that aims to be a better version of age and Minisign.
Stars: ✭ 267 (-70.66%)
Mutual labels:  libsodium, ed25519
Enacl
Erlang bindings for NaCl / libsodium
Stars: ✭ 159 (-82.53%)
Mutual labels:  cryptography, libsodium
Ed25519 Dalek
Fast and efficient ed25519 signing and verification in Rust.
Stars: ✭ 383 (-57.91%)
Mutual labels:  cryptography, ed25519
Streamcryptor
Stream encryption & decryption with libsodium and protobuf
Stars: ✭ 112 (-87.69%)
Mutual labels:  cryptography, libsodium
Wasm Crypto
A WebAssembly (via AssemblyScript) set of cryptographic primitives for building authentication and key exchange protocols.
Stars: ✭ 146 (-83.96%)
Mutual labels:  cryptography, ed25519
Libsodium Php
The PHP extension for libsodium.
Stars: ✭ 507 (-44.29%)
Mutual labels:  cryptography, libsodium
Keys
Key management is hard
Stars: ✭ 733 (-19.45%)
Mutual labels:  cryptography, ed25519

RbNaCl

Gem Version Build Status Code Climate Coverage Status MIT licensed

Ruby binding for libsodium, a fork of the Networking and Cryptography library.

Why libsodium/NaCl?

NaCl is a different kind of cryptographic library. In the past crypto libraries were kitchen sinks of little bits and pieces, like ciphers, MACs, signature algorithms, and hash functions. To accomplish anything you had to make a lot of decisions about which specific pieces to use, and if any of your decisions were wrong, the result was an insecure system. The choices are also not easy: EAX? GCM? CCM? AES-CTR? CMAC? OMAC1? AEAD? NIST? CBC? CFB? CTR? ECB? OMGWTFBBQ!

NaCl puts cryptography on Rails! Instead of making you choose which cryptographic primitives to use, NaCl provides convention over configuration in the form of expertly-assembled high-level cryptographic APIs that ensure not only the confidentiality of your data, but also detect tampering. These high-level, easy-to-use APIs are designed to be hard to attack by default in ways primitives exposed by libraries like OpenSSL are not.

This approach makes NaCl a lot closer to a system like GPG than it is to the cryptographic primitive APIs in a library like OpenSSL. In addition, NaCl also uses state-of-the-art encryption, including Curve25519 elliptic curves and the XSalsa20 stream cipher. This means with NaCl you not only get a system which is designed to be secure-by-default, you also get one which is extremely fast with comparatively small cryptographic keys.

Is it any good?

Yes.

Supported platforms

You can use RbNaCl on platforms libsodium is supported (see below).

This library aims to support and is tested against the following Ruby versions:

  • Ruby 2.5
  • Ruby 2.6
  • Ruby 2.7
  • JRuby 9.2

If something doesn't work on one of these versions, it's a bug.

Installation

Note: Windows installation instructions are available.

libsodium

To use RbNaCl, you will need to install libsodium:

https://github.com/jedisct1/libsodium

At least version 1.0.0 is required.

For OS X users, libsodium is available via homebrew and can be installed with:

brew install libsodium

For FreeBSD users, libsodium is available both via pkgng and ports. To install a binary package:

pkg install libsodium

To install from ports on FreeBSD, use your favorite ports front end (e.g. portmaster or portupgrade), or use make as follows:

cd /usr/ports/security/libsodium; make install clean

RbNaCl gem

Once you have libsodium installed, add this line to your application's Gemfile:

gem 'rbnacl'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rbnacl

Inside of your Ruby program do:

require 'rbnacl'

...to pull it in as a dependency.

Documentation

RbNaCl's documentation can be found in the Wiki. The following features are supported:

  • SimpleBox: easy-to-use public-key or secret-key encryption "on Rails"
  • Secret-key Encryption: authenticated symmetric encryption using a single key shared among parties
  • Public-key Encryption: securely send messages to a given public key which can only be decrypted by a secret key
  • Digital Signatures: sign messages with a private key which can be verified by a public one
  • Authenticators: create codes which can be used to check the authenticity of messages
  • Hash Functions: compute a secure, fixed-length code from a message which does not reveal the contents of the message

Additional power-user features are available. Please see the Wiki for further information.

YARD API documentation is also available.

Learn More

While NaCl has designed to be easier-than-usual to use for a crypto library, cryptography is an incredibly difficult subject and it's always helpful to know as much as you can about it before applying it to a particular use case. That said, the creator of NaCl, Dan Bernstein, has published a number of papers about NaCl. If you are interested in learning more about how NaCl works, it's recommended that you read them:

For more information on libsodium, please check out the Introducing Sodium blog post

Have a general interest in cryptography? Check out the free course Coursera offers from Stanford University Professor Dan Boneh:

http://crypto-class.org

Important Questions

Is it "Military Grade™"?

Only if your military understands twisted Edwards curves

Is it "Bank Grade™"?

No, that means 3DES, which this library doesn't support, sorry

Does it have a lock with a checkmark?

Sure, here you go:

Checkmarked Lock

Contributing

  • Fork this repository on Github
  • Make your changes and send a pull request
  • If your changes look good, we'll merge 'em

License

Copyright (c) 2012-2018 Tony Arcieri, Jonathan Stott. Distributed under the MIT License. See LICENSE.txt for further details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].