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



24
25
26
27
28
29
30
31
32
# File 'lib/backup/encryptor/open_ssl.rb', line 24

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



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

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.



7
8
9
# File 'lib/backup/encryptor/open_ssl.rb', line 7

def password
  @password
end

#password_fileObject

The password file to use to encrypt the backup.



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

def password_file
  @password_file
end

#saltObject

Determines whether the ‘salt’ flag should be used



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

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")


40
41
42
43
# File 'lib/backup/encryptor/open_ssl.rb', line 40

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