Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 1.18 KB

README.rdoc

File metadata and controls

35 lines (21 loc) · 1.18 KB

A ruby interface to the keyczar crypto library. Provides basic encrypt, decrypt, sign and verify methods. This is just a wrapper around the c++ version of keyczar. You will need keyczar-cpp in order to use it. Find keyczar-cpp here: code.google.com/p/keyczar/downloads/list

For now, we assume that keyczar-cpp was installed with the prefix /usr/local. You should be able to install it with these commands:

$ cd keyczar-cpp/src 
$ sh ./tools/swtoolkit/hammer.sh --mode=opt-linux --compat
$ sh ./tools/swtoolkit/hammer.sh --mode=opt-linux --compat install

replace opt-linux above by opt-bsd or opt-mac depending on your system

Methods:

Keyczar::Crypter#encrypt(plaintext)    #=> cryptext
Keyczar::Crypter#decrypt(cryptext)     #=> plaintext
Keyczar::Signer#sign(text)             #=> signature
Keyczar::Signer#verify(text,signature) #=> true or false

The first 3 return empty string on error. #encrypt and #sign results are base64 encoded.

The first 3 return nil when passed nil. The 4th returns false when passed a nil for either text or signature.

Installation

Simple:

$ gem install keyczar_ruby

For bundler, add it to your Gemfile and run

$ bundle install