summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Schmeckpeper <ben.schmeckpeper@gmail.com>2022-07-20 11:43:40 -0500
committerBen Schmeckpeper <ben.schmeckpeper@gmail.com>2022-07-20 11:51:21 -0500
commit6792bebca7c4a92f7145811fc0cd3ba8551cb8a4 (patch)
tree5a617a73d32c7ff06e7070b1f15a3b32babcf6c0
parent27c51ba2013362857c153bc370ea3ecd156a2b07 (diff)
downloadnet-ssh-6792bebca7c4a92f7145811fc0cd3ba8551cb8a4.tar.gz
Raise an error if BCryptPbkdf doesn't give us a key
This can happen if we request fewer than 1 round or if the password or salt are blank or keylen + ivlen is zero.
-rw-r--r--lib/net/ssh/authentication/ed25519.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/net/ssh/authentication/ed25519.rb b/lib/net/ssh/authentication/ed25519.rb
index dccc64f..892000a 100644
--- a/lib/net/ssh/authentication/ed25519.rb
+++ b/lib/net/ssh/authentication/ed25519.rb
@@ -77,6 +77,7 @@ module Net
raise "BCryptPbkdf is not implemented for jruby" if RUBY_PLATFORM == "java"
key = BCryptPbkdf::key(password, salt, keylen + ivlen, rounds)
+ raise DecryptError.new("BCyryptPbkdf failed", encrypted_key: true) unless key
else
key = '\x00' * (keylen + ivlen)
end