A Ruby Gem to Secure your files Easily Using OpenSSL::AES Standars
gem install encrypter_decrypter_files
Usage
Encryption
Ankits-MacBook-Pro:encrypter_decrypter_files ankitgupta$ irb
1.9.3-p448 :001 > require 'encrypter_decrypter_files'
=> true
1.9.3-p448 :002 > EDfile.encrypt(path: 'foo.txt')
=> 123
You can also pass on the key_size
by default it's 256
Ankits-MacBook-Pro:encrypter_decrypter_files ankitgupta$ irb
1.9.3-p448 :001 > require 'encrypter_decrypter_files'
=> true
1.9.3-p448 :002 > EDfile.encrypt(path: 'foo.txt',key_size: 128)
=> 122
The Above will store the values in a iv_key.yml
, Eg
foo.txt:
:iv: !binary |-
fu/JUHy+i1+Tz1NcdF2m6A==
:key: !binary |-
jTvX8mJDrvRA/RdyXnlgpA+5i18hMjbPX4DGaLiROFw=
Decryption
Ankits-MacBook-Pro:encrypter_decrypter_files ankitgupta$ irb
1.9.3-p448 :001 > require 'encrypter_decrypter_files'
=> true
1.9.3-p448 :002 > EDfile.decrypt(path: 'foo.txt.enc')
"Holla, Decrypted!"
=> nil
The gem itself is released under the MIT license
🙏