Skip to content

Commit

Permalink
resolve openssl deprecation, Rubocop: Lint/DeprecatedOpenSSLConstant
Browse files Browse the repository at this point in the history
> 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] rubocop/rubocop#7950
[2] ruby/openssl#366

The previous constant will cause failures in Ruby 3.

Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Robb Kidd <rkidd@chef.io>
  • Loading branch information
tas50 authored and robbkidd committed Jun 1, 2020
1 parent c21b775 commit b021488
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/supermarket/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b021488

Please sign in to comment.