Class: CICI::Encrypt

Inherits:
Object
  • Object
show all
Includes:
CICI
Defined in:
lib/cici/encrypt.rb

Constant Summary

Constants included from CICI

DECRYPT_IV_ENV_VAR, DECRYPT_KEY_ENV_VAR

Instance Method Summary collapse

Constructor Details

#initialize(ui, decrypter, config) ⇒ Encrypt

Returns a new instance of Encrypt.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cici/encrypt.rb', line 17

def initialize(ui, decrypter, config)
  @ui = ui
  @config = config
  @util = CICI::Util.new(@ui)
  @decrypter = decrypter

  # Default key/iv that's generated for you. We can change these values later before encryption.
  aes = OpenSSL::Cipher.new('AES-256-CBC')
  aes.encrypt
  @encryption_key = aes.random_key
  @encryption_iv = aes.random_iv
  @first_time_encrypting = false
end

Instance Method Details

#startObject



31
32
33
34
35
36
37
38
# File 'lib/cici/encrypt.rb', line 31

def start
  assert_secret_files_exist
  # We want to reuse key/iv values for encryption. So, let's get those values before moving forward.
  prompt_for_keys
  compress
  assert_files_in_gitignore
  encrypt
end