Skip to content

Commit

Permalink
Make error message a bit more meaningful if cannot decrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoff Meakin committed Jul 12, 2013
1 parent 9b20b33 commit d9264cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/hiera/backend/eyaml_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ def decrypt(value, scope)

private_key = OpenSSL::PKey::RSA.new(File.read( private_key_path ))

plain_text = private_key.private_decrypt( Base64.decode64(cipher_text) )

begin
plain_text = private_key.private_decrypt( Base64.decode64(cipher_text) )
rescue
raise Exception, "Hiera eyaml backend: Unable to decrypt hiera data. Private key mismatch?"
end

return plain_text
else
return value
Expand Down

0 comments on commit d9264cf

Please sign in to comment.