Class: Backup::Encryptor::OpenSSL

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/encryptor/open_ssl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Config::Helpers

included

Constructor Details

#initialize(&block) ⇒ OpenSSL

Creates a new instance of Backup::Encryptor::OpenSSL and sets the password attribute to what was provided



27
28
29
30
31
32
33
34
35
# File 'lib/backup/encryptor/open_ssl.rb', line 27

def initialize(&block)
  super

  @base64        ||= false
  @salt          ||= true
  @password_file ||= nil

  instance_eval(&block) if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers

Instance Attribute Details

#base64Object

Determines whether the ‘base64’ should be used or not



18
19
20
# File 'lib/backup/encryptor/open_ssl.rb', line 18

def base64
  @base64
end

#passwordObject

The password that’ll be used to encrypt the backup. This password will be required to decrypt the backup later on.



10
11
12
# File 'lib/backup/encryptor/open_ssl.rb', line 10

def password
  @password
end

#password_fileObject

The password file to use to encrypt the backup.



14
15
16
# File 'lib/backup/encryptor/open_ssl.rb', line 14

def password_file
  @password_file
end

#saltObject

Determines whether the ‘salt’ flag should be used



22
23
24
# File 'lib/backup/encryptor/open_ssl.rb', line 22

def salt
  @salt
end

Instance Method Details

#encrypt_with {|"#{ utility(:openssl) } #{ options }", '.enc'| ... } ⇒ Object

This is called as part of the procedure run by the Packager. It sets up the needed options to pass to the openssl command, then yields the command to use as part of the packaging procedure. Once the packaging procedure is complete, it will return so that any clean-up may be performed after the yield.

Yields:

  • ("#{ utility(:openssl) } #{ options }", '.enc')


43
44
45
46
# File 'lib/backup/encryptor/open_ssl.rb', line 43

def encrypt_with
  log!
  yield "#{ utility(:openssl) } #{ options }", '.enc'
end