Use
OpenSSL::Cipher.new('aes-128-gcm')
instead of OpenSSL::Cipher::AES.new(128, :GCM)
.49end
50
51# Raises "Deprecated way of initializing OpenSSL::Cipher and OpenSSL::Digest"
52OpenSSL::Cipher::AES.new(128, :GCM)53
54# Raises "put empty method definitions on a single line"
55# Also raises "multiple methods with same name in the same scope" as we have a
Description
Algorithmic constants for OpenSSL::Cipher and OpenSSL::Digest have been deprecated since OpenSSL version 2.2.0. Use of strings is preferred.
Bad practice
OpenSSL::Cipher::AES.new(128, :GCM)
OpenSSL::Digest::SHA256.new
OpenSSL::Digest::SHA256.digest('foo')
Recommended
OpenSSL::Cipher.new('aes-128-gcm')
OpenSSL::Digest.new('SHA256')
OpenSSL::Digest.digest('SHA256', 'foo')