-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,8 +52,9 @@ def crypt(cipher_method, *args) #:nodoc: | |
cipher = OpenSSL::Cipher::Cipher.new(options[:algorithm]) | ||
cipher.send(cipher_method) | ||
if options[:iv] | ||
cipher.key = options[:key] | ||
raise ArgumentError.new('you must specify a :salt') if options[:salt].nil? | ||
cipher.iv = options[:iv] | ||
cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(options[:key], options[:salt], 2000, cipher.key_len) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
danpal
Owner
|
||
else | ||
cipher.pkcs5_keyivgen(options[:key]) | ||
end | ||
|
'key' should be used for secret key, not for password of PBKDF. Arguments should be either of 'key and iv', 'password, salt and iv' and 'password'. The correct way is between encryptor and encryptor2...