From b0214881dab6a259fc29c56025f99011f1621cff Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 22 May 2020 10:38:16 -0700 Subject: [PATCH] resolve openssl deprecation, Rubocop: Lint/DeprecatedOpenSSLConstant > Lint/DeprecatedOpenSSLConstant: > Use OpenSSL::Digest.hexdigest('MD5', key_in_der_format) instead of > OpenSSL::Digest::MD5.hexdigest(key_in_der_format). Rubocop has a new cop[1] that detects an upcoming deprecation to the OpenSSL gem[2] that's built into Ruby. [1] https://github.com/rubocop-hq/rubocop/pull/7950 [2] https://github.com/ruby/openssl/pull/366 The previous constant will cause failures in Ruby 3. Signed-off-by: Tim Smith Signed-off-by: Robb Kidd --- src/supermarket/app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/supermarket/app/models/user.rb b/src/supermarket/app/models/user.rb index aa1ed7879..671a7f095 100644 --- a/src/supermarket/app/models/user.rb +++ b/src/supermarket/app/models/user.rb @@ -226,7 +226,7 @@ def public_key_signature # with private key: openssl rsa -in private_key.pem -pubout -outform DER | openssl md5 -c # with public key: openssl rsa -in public_key.pub -pubin -outform DER | openssl md5 -c key_in_der_format = OpenSSL::PKey::RSA.new(public_key).to_der - OpenSSL::Digest::MD5.hexdigest(key_in_der_format).scan(/../).join(':') + OpenSSL::Digest.hexdigest('MD5', key_in_der_format).scan(/../).join(':') end private