Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

omit -pass option in decrypt command if --password-file not given (fixes #312) #323

Merged
merged 1 commit into from

1 participant

@ghost

No description provided.

@ghost Unknown referenced this pull request
Closed

Decrypt Failing #312

@meskyanichi meskyanichi closed this
@meskyanichi
Owner

Thanks!

@meskyanichi meskyanichi reopened this
@meskyanichi meskyanichi merged commit 4c66ebc into from
@ghost Unknown referenced this pull request
Closed

openssl decrypt with password #328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 7, 2012
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 2 deletions.
  1. +2 −2 lib/backup/cli/utility.rb
  2. +13 −0 spec/cli/utility_spec.rb
View
4 lib/backup/cli/utility.rb
@@ -173,7 +173,7 @@ def decrypt
case options[:encryptor].downcase
when 'openssl'
base64 = options[:base64] ? '-base64' : ''
- password = options[:password_file] ? "-pass file:#{options[:password_file]}" : ''
+ password = options[:password_file].empty? ? '' : "-pass file:#{options[:password_file]}"
salt = options[:salt] ? '-salt' : ''
%x[openssl aes-256-cbc -d #{base64} #{password} #{salt} -in '#{options[:in]}' -out '#{options[:out]}']
when 'gpg'
@@ -224,7 +224,7 @@ def dependencies
puts "Please wait..\n\n"
puts %x[gem install #{options[:install]} -v '#{Backup::Dependency.all[options[:install]][:version]}']
end
-
+
if options[:installed]
puts %x[gem list -i -v '#{Backup::Dependency.all[options[:installed]][:version]}' #{options[:installed]}]
end
View
13 spec/cli/utility_spec.rb
@@ -305,6 +305,19 @@
# cli.start
# end
#
+# it 'should omit -pass option if no --password-file given' do
+# ARGV.replace(['decrypt', '--encryptor', 'openssl',
+# '--in', 'in_file',
+# '--out', 'out_file',
+# '--base64', '--salt'])
+#
+# cli.any_instance.expects(:`).with(
+# "openssl aes-256-cbc -d -base64 -salt " +
+# "-in 'in_file' -out 'out_file'"
+# )
+# cli.start
+# end
+#
# it 'should perform GnuPG decryption' do
# ARGV.replace(['decrypt', '--encryptor', 'gpg',
# '--in', 'in_file',
Something went wrong with that request. Please try again.