Class: Backup::Encryptor::OpenSSL
- Defined in:
- lib/backup/encryptor/open_ssl.rb
Instance Attribute Summary collapse
-
#base64 ⇒ Object
writeonly
Determines whether the ‘base64’ should be used or not.
-
#password ⇒ Object
The password that’ll be used to encrypt the backup.
-
#salt ⇒ Object
writeonly
Determines whether the ‘salt’ flag should be used.
Instance Method Summary collapse
-
#initialize(&block) ⇒ OpenSSL
constructor
Creates a new instance of Backup::Encryptor::OpenSSL and sets the password attribute to what was provided.
-
#perform! ⇒ Object
Performs the encryption of the backup file.
Methods inherited from Base
Methods included from Configuration::Helpers
#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods
Methods included from CLI
Constructor Details
#initialize(&block) ⇒ OpenSSL
Creates a new instance of Backup::Encryptor::OpenSSL and sets the password attribute to what was provided
23 24 25 26 27 28 29 30 |
# File 'lib/backup/encryptor/open_ssl.rb', line 23 def initialize(&block) load_defaults! @base64 ||= false @salt ||= false instance_eval(&block) if block_given? end |
Instance Attribute Details
#base64=(value) ⇒ Object
Determines whether the ‘base64’ should be used or not
14 15 16 |
# File 'lib/backup/encryptor/open_ssl.rb', line 14 def base64=(value) @base64 = value end |
#password ⇒ Object
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 |
#salt=(value) ⇒ Object
Determines whether the ‘salt’ flag should be used
18 19 20 |
# File 'lib/backup/encryptor/open_ssl.rb', line 18 def salt=(value) @salt = value end |
Instance Method Details
#perform! ⇒ Object
Performs the encryption of the backup file
34 35 36 37 38 39 |
# File 'lib/backup/encryptor/open_ssl.rb', line 34 def perform! log! run("#{ utility(:openssl) } #{ } -in '#{ Backup::Model.file }' -out '#{ Backup::Model.file }.enc' -k '#{ password }'") rm(Backup::Model.file) Backup::Model.extension += '.enc' end |