lib/encrypted_keystore.rb in encrypted-keystore-0.0.3 vs lib/encrypted_keystore.rb in encrypted-keystore-0.0.4
- old
+ new
@@ -4,9 +4,21 @@
require 'openssl'
require 'base64'
attr_accessor :file, :out, :key, :iv
+ def self.encrypt(file, out)
+ enc = new(file: file, out: out)
+ enc.encrypt
+
+ { key: enc.key, iv: enc.iv }
+ end
+
+ def self.decrypt(file, out, key, iv)
+ enc = new(file: file, out: out, key: key, iv: iv)
+ enc.decrypt
+ end
+
def initialize(file: nil, out: nil, key: nil, iv: nil)
@file = file
@out = out
@key = key
@iv = iv