Crypto Laser

Simple library for symmetric authenticated encryption.

key = SecureRandom.random_bytes(64)
cipher_text = CryptoLaser.encrypt(key, "my secret message")
plain_text = CryptoLaser.decrypt(key, cipher_text)

Most of the work is done by the aead gem, which itself relies on OpenSSL. Since many users, ourselves included, are on OS X, this library uses AES-256-CBC-HMAC-SHA-256 as the cipher and MAC.

Additional features provided by this library are:

  • Nonce management. No one knows what a nonce is, so this library just takes care of that for you.
  • Base64 encoding of ciphertexts for easy portability.
  • The value returned by encrypt includes the nonce and the algorithm used to create the ciphertext. The algorithm is authenticated, allowing for later cipher suite negotiation should AES-256-CBC prove unreliable.