Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 

jodid

RubyDoc

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)

About

Object oriented library to libsodium with a keychain

Resources

License

Packages

No packages published

Languages