The aim of this project is to use Public Key Encryption to ensure and enforce the securty principles of "Separation of Duties" in Ruby on Rails applications
Pull request Compare This branch is even with ripienaar:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What is it?

A class that assists in encrypting and decrypting data using a combination of RSA and AES

Data will be AES encrypted for speed, the Key and IV used in the AES stage will be encrypted using RSA

ssl =, private_key, passphrase, "aes-256-cbc")

data ="largefile.dat")

crypted_data = ssl.encrypt_with_private(data)

pp crypted_data

This will result in a hash of data like:

crypted = {:key  => "crd4NHvG....=",
           :data => "XWXlqN+i...=="}

The key and data will be base 64 encoded already

You can pass the data hash into ssl.decrypt_with_public which should return your original data

There are matching methods for using a public key to encrypt data to be decrypted using a private key

Realted Links?


Apache 2.0


R.I.Pienaar / / / @ripienaar