jodid
Requirements
ruby >= 1.9.3
libsodium >= 1.0.1
Installation instructions
Mac OS X/Linux
brew install libsodium
Generic
gem install --prerelease jodid
Basic usage
bob_chain = Jodid::Keychain.new
Create a user
bob_public_key = bob_chain.auth('bob', 'bob')
Authenticate a user
bob = bob_chain.verify('bob', 'bob')
Secret-Key Encryption
Encrypt a plaintext
ciphertext = bob.secretbox('plaintext')
Decrypt a ciphertext
bob.secretbox_open(ciphertext)
Public-Key Encryption
alice_chain = Jodid::Keychain.new
alice_chain.store_public_key('bob', bob_public_key)
alice_public_key = alice_chain.auth('alice', 'alice')
bob_chain.store_public_key('alice', alice_public_key)
alice = alice_chain.verify('alice', 'alice')
Encrypt a plaintext
ciphertext = bob.box('hello', 'alice')
Decrypt a ciphertext
puts alice.box_open(ciphertext)
puts alice_chain.fetch_identity(ciphertext[0...Crypto::Box::PUBLICKEYBYTES])
Public-Key Signatures
message = 'good morning'
Generate a signature for a message
sigature = alice.sign_detached(message)
Verify a message signature
alice.sign_verify_detached(signature, message)