Class: BB8::Encrypt
- Inherits:
-
Object
- Object
- BB8::Encrypt
- Defined in:
- lib/bb8/encrypt.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(path) ⇒ Encrypt
constructor
A new instance of Encrypt.
Constructor Details
#initialize(path) ⇒ Encrypt
Returns a new instance of Encrypt.
6 7 8 |
# File 'lib/bb8/encrypt.rb', line 6 def initialize(path) @path = path end |
Class Method Details
.call(path) ⇒ Object
2 3 4 |
# File 'lib/bb8/encrypt.rb', line 2 def self.call(path) new(path).call end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bb8/encrypt.rb', line 10 def call cipher.encrypt cipher.key = bundle.variables['BB8_SECRET_KEY'] cipher.iv = bundle.variables['BB8_SECRET_IV'] buffer = "" File.open("#{path}.enc", "wb") do |output| File.open(path, "rb") do |input| while input.read(4096, buffer) output << cipher.update(buffer) end output << cipher.final end end end |