Class: Rgc::Smudge

Inherits:
Object
  • Object
show all
Includes:
KeyFile
Defined in:
lib/rgc/smudge.rb

Instance Method Summary collapse

Methods included from KeyFile

#load_key

Constructor Details

#initialize(global_options, options, args) ⇒ Smudge

Returns a new instance of Smudge.



5
6
7
8
9
# File 'lib/rgc/smudge.rb', line 5

def initialize(global_options, options, args)
  load_key

  print(decrypt(ARGF.read))
end

Instance Method Details

#decrypt(content) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rgc/smudge.rb', line 11

def decrypt(content)
  @aes = OpenSSL::Cipher.new("AES-128-CBC")
  @aes.decrypt
  @aes.key = @key

  @aes.update(Base64.decode64(content)) + @aes.final
end