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. Download a zip or clone the repo here: github.com/google/keyczar
keyczar requires gtest. If you don’t already have it, download a copy from code.google.com/p/googletest/downloads and unpack it in a convenient location (you’ll need the path for the build command below).
For now, we assume that keyczar was installed with the prefix /usr/local. You should be able to install it with these commands:
$ cd cpp/src $ sh ./tools/swtoolkit/hammer.sh -D GTEST_DIR=YOUR_GTEST_PATH --mode=opt-linux --compat $ sh ./tools/swtoolkit/hammer.sh -D GTEST_DIR=YOUR_GTEST_PATH --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.
Simple:
$ gem install keyczar_ruby
For bundler, add it to your Gemfile and run
$ bundle install