Skip to content

Asmod4n/jodid

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
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

Stars

Watchers

Forks

Packages

No packages published

Languages