Dualcone is a Ruby source code protection system. Dualcone uses symmetric encryption to protect your source code.
Dualcone is a self-contained gem. It brings along its own copy of the lightweight cryptographic library, libhydrogen.
Dualcone supports GNU + Linux and other Unix-like operating systems. Windows is not supported.
- [x] Key generation:
- [x] Encrypted code running:
- [x] Encrypted code generation:
- [x] Specs passing
- [x] Runnable trivial ruby script
- [ ] Runnable non-trivial ruby script
- [ ] Runnable sinatra app
- [ ] Runnable rails app
Add this gem to your application's Gemfile:
And then execute:
$ bundle install
Or install it yourself as:
$ gem install dualcone
You need to have a C compiler and
make installed on your system to be able to build this gem's native code and the included version of
Generate a secret encryption key.
require 'dualcone' Dualcone.generate_key => "764888c92f3059c88524225b622cd178856877cf3537230a9d7f5b5b6d8850c5"
Place your encryption key in the
$ export DUALCONE_HEX_KEY="8c8f91f84d8e554dc03277ce2f038af95cd932e2b65011969e77d3ac18d7bdd9"
This environment variable is required for both encrypting files as well as running already-encrypted files.
Encrypt your Ruby source code file(s).
:warning: Your source code file will be modified in-place. This is a one-way operation! :warning:
For example, let's say we have a file named
hello.rbwith the following contents:
puts 'Hello, world!'
You can encrypt this file using
The entire contents of the file
hello.rbwill be replaced with a call to
require 'dualcone' .('7f1a1b6a047aee2403e415044b72f2ac2997cef689960df46afdfe6d7c657e18dbae1bea3bbe33ae9157cb2f7b22f34db69b2eb41e05aa512151')
Finally, test your encrypted code by running it.
$ ruby hello.rb
git clone [email protected]:t-richards/dualcone.gitto clone the repo.
bin/setupto install dependencies and fetch git submodules.
bin/rake compileto build the gem's native extensions.
bin/rspecto run the tests.
bin/rubocopto check code style.
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
bin/rake install. To release a new version, update the version number in
version.rb, and then run
bin/rake release, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/t-richards/dualcone.
The gem is available as open source under the terms of the MIT License.