Project

oroku_saki

0.03
Low commit activity in last 3 years
No release in over a year
OrokuSaki, a.k.a. Shredder, is a small collection of utilities for ensuring the strings used in cryptographic operations remain secret. This currently includes memory zeroing and constant time String comparisons.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.2.33
~> 8.2
~> 3.0
~> 12.3.2
~> 0.9.11
 Project Readme

OrokuSaki

Build Status Gem Version

OrokuSaki, a.k.a. Shredder, is the destroyer of strings and attacker's worst nightmare!

But seriously, this is a collection of small tools for helping your secrets in crypto applications stay secret.

Installation

Add this line to your application's Gemfile:

gem 'oroku_saki'

And then execute:

$ bundle

Or install it yourself as:

$ gem install oroku_saki

Usage

Immediately zeroing out the memory location of a string you want to protect:

my_secret = 'super sekret value!!!'
OrokuSaki.shred!(my_secret) # => nil
puts my_secret # => "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"

second_secret = 'another sekret'
# String#shred! delegates to OrokuSaki.shred!
second_secret.shred! # => "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"

Setting a string to be shredded before garbage collection via a finalizer:

my_secret = 'super sekret value!!!'
OrokuSaki.shred_later(my_secret) # => nil
puts my_secret # => "super sekret value!!!"

second_secret = 'another sekret'
second_scret.shred_later

Comparing Strings in constant time (nearly as fast as == for small inputs):

hmac = '16b9b8ae8e164768d0505bcb16269efb35804643dd351084b3c6ebbc6f7db2c8'
other_hmac = '16b9b8ae8e164768d0505bcb16269efb35804643dd351084b3c6ebbc6f7db2c8'
OrokuSaki.secure_compare(hmac, other_hmac) #=> true

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tpickett66/oroku_saki. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.