Class: EncryptedKeystore

Inherits:
Object
  • Object
show all
Defined in:
lib/encrypted_keystore.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file: nil, out: nil, key: nil, iv: nil) ⇒ EncryptedKeystore

Returns a new instance of EncryptedKeystore.



9
10
11
12
13
14
# File 'lib/encrypted_keystore.rb', line 9

def initialize(file: nil, out: nil, key: nil, iv: nil)
  @file = file
  @out = out
  @key = key
  @iv = iv
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



7
8
9
# File 'lib/encrypted_keystore.rb', line 7

def file
  @file
end

#ivObject

Returns the value of attribute iv.



7
8
9
# File 'lib/encrypted_keystore.rb', line 7

def iv
  @iv
end

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/encrypted_keystore.rb', line 7

def key
  @key
end

#outObject

Returns the value of attribute out.



7
8
9
# File 'lib/encrypted_keystore.rb', line 7

def out
  @out
end

Instance Method Details

#decryptObject



16
17
18
19
20
# File 'lib/encrypted_keystore.rb', line 16

def decrypt
  validate

  write(dec_cipher)
end

#encryptObject



22
23
24
25
26
# File 'lib/encrypted_keystore.rb', line 22

def encrypt
  validate(enc: true)

  write(enc_cipher)
end