Izokatu
¶ ↑
Izokatu
is Ruby library that provides abstact interface for private-key and public-key cryptography using RbNaCl and OpenSSL.
Features¶ ↑
-
Unified interaction with RbNaCL and OpenSSL via
Izokatu#call
-
Strong defaults:
-
RbNaCl private-key cryptography -
XChaCha20Poly1305IETF
-
RbNaCl public-key cryptography -
Curve25519XSalsa20Poly1305
-
OpenSSL private-key cryptography -
AES-256-GCM
-
OpenSSL public-key RSA cryptography -
4096 bit key
-
OpenSSL hybrid EC (ECIES) cryptography:
-
Public-key part -
secp521r1
-
Private-key part -
AES-256-CTR
-
-
2 Import modes:
:function
(default, gets data from options),:file
-
3 Export modes:
:function
(default, just returns result),:file
,:stdout
Installation¶ ↑
<s>gem install izokatu</s>
Lost my access to rubygems acc, confirmation email are not received on mail, docs for gem are deleted (https://www.rubydoc.info/gems/izokatu), but early version gem itself is available. Don't use izokatu from rubygems.
So, use izokatu from git:
gem 'izokatu', :git => 'https://gitlab.com/mongalless/izokatu.git
in Gemfile
Or download .gem file in root and execute:
gem install ./path_to_gem_file/gem_file
If you have trouble installing the gem, file a ticket on the issues page.
Usage¶ ↑
RbNaCl private key cryptography
encrypted_data = Izokatu.call(clear_data_string: 'Some data') Izokatu.call(action: :decryption, **encrypted_data) => {:decrypted_data_string=>"Some data"}
RbNaCl public key cryptography
keypair1 = Izokatu.call(action: :keys_generation, mode: :public_key) keypair2 = Izokatu.call(action: :keys_generation, mode: :public_key) encrypted_data = Izokatu.call( clear_data_string: 'Some data', mode: :public_key, public_key: keypair1[:public_key], private_key: keypair2[:private_key] ) Izokatu.call( action: :decryption, mode: :public_key, **encrypted_data, public_key: keypair2[:public_key], private_key: keypair1[:private_key] ) => {:decrypted_data_string=>"Some data"}
OpenSSL private key cryptography
encrypted_data = Izokatu.call( clear_data_string: 'Some data', via: :openssl, cipher: 'AES-256-GCM' ) Izokatu.call( action: :decryption, **encrypted_data, via: :openssl, cipher: 'AES-256-GCM' ) => {:decrypted_data_string=>"Some data"}
OpenSSL EC public key cryptography
keypair_options = { action: :keys_generation, mode: :public_key, via: :openssl } keypair1 = Izokatu.call(keypair_options) keypair2 = Izokatu.call(keypair_options) encrypted_data = Izokatu.call( clear_data_string: 'Some data', mode: :public_key, via: :openssl, public_key: keypair1[:public_key], private_key: keypair2[:private_key] ) Izokatu.call( action: :decryption, mode: :public_key, via: :openssl, **encrypted_data, public_key: keypair2[:public_key], private_key: keypair1[:private_key] ) => {:decrypted_data_string=>"Some data"}
OpenSSL RSA public key cryptography
keypair_options = { action: :keys_generation, mode: :public_key, via: :openssl, asym_cipher_type: :rsa, bit_number: 4096 } keypair1 = Izokatu.call(keypair_options) keypair2 = Izokatu.call(keypair_options) encrypted_data = Izokatu.call( clear_data_string: 'Some data', mode: :public_key, via: :openssl, public_key: keypair1[:public_key], private_key: keypair2[:private_key], asym_cipher_type: :rsa ) Izokatu.call( action: :decryption, mode: :public_key, via: :openssl, **encrypted_data, public_key: keypair2[:public_key], private_key: keypair1[:private_key], asym_cipher_type: :rsa ) => {:decrypted_data_string=>"Some data"}
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 gitlab.com/mongalless/izokatu.
License¶ ↑
The gem is available as open source under the terms of the MIT License.