class BB8::Decrypt
Attributes
path[R]
Public Class Methods
call(path)
click to toggle source
# File lib/bb8/decrypt.rb, line 2 def self.call(path) new(path).call end
new(path)
click to toggle source
# File lib/bb8/decrypt.rb, line 6 def initialize(path) @path = path end
Public Instance Methods
call()
click to toggle source
# File lib/bb8/decrypt.rb, line 10 def call cipher.decrypt cipher.key = bundle.variables['BB8_SECRET_KEY'] cipher.iv = bundle.variables['BB8_SECRET_IV'] buffer = "" File.open(path.gsub('.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
Private Instance Methods
bundle()
click to toggle source
# File lib/bb8/decrypt.rb, line 30 def bundle @bundle ||= BB8::Voltos.current_bundle end
cipher()
click to toggle source
# File lib/bb8/decrypt.rb, line 34 def cipher @cipher ||= OpenSSL::Cipher.new('aes-256-cbc') end