Fix issues raising from upgrade to Ruby 2.4

This commit is contained in:
Maciej Szlosarczyk 2018-08-15 12:47:27 +03:00
parent 646fb76007
commit 4a6742692a
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
5 changed files with 11 additions and 5 deletions

View file

@ -16,7 +16,10 @@ class AuthTokenDecryptor
def decrypt_token
decipher = OpenSSL::Cipher::AES.new(256, :CBC)
decipher.decrypt
decipher.key = key
# OpenSSL used to automatically shrink oversized keys, it does not do that any longer.
# See: https://github.com/ruby/openssl/issues/116
decipher.key = key[0..31]
base64_decoded = Base64.urlsafe_decode64(token.to_s)
plain = decipher.update(base64_decoded) + decipher.final