Skip to content

Commit 70d9fa3

Browse files
committed
Lint/DeprecatedOpenSSLConstant
From https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/DeprecatedOpenSSLConstant Algorithmic constants for ‘OpenSSL::Cipher` and `OpenSSL::Digest` deprecated since OpenSSL version 2.2.0. Prefer passing a string instead.
1 parent cfac766 commit 70d9fa3

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,6 @@ Lint/BooleanSymbol:
589589
Lint/ConstantDefinitionInBlock:
590590
Enabled: false
591591

592-
# This cop supports safe auto-correction (--auto-correct).
593-
Lint/DeprecatedOpenSSLConstant:
594-
Exclude:
595-
- 'lib/puppet/util/checksums.rb'
596-
- 'lib/puppet/x509/cert_provider.rb'
597-
598592
# This cop supports safe auto-correction (--auto-correct).
599593
Lint/ElseLayout:
600594
Exclude:

lib/puppet/util/checksums.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def sha512_hex_length
156156
# Calculate a checksum using Digest::SHA224.
157157
def sha224(content)
158158
require_relative '../../puppet/ssl/openssl_loader'
159-
OpenSSL::Digest::SHA224.new.hexdigest(content)
159+
OpenSSL::Digest.new('SHA224').hexdigest(content)
160160
end
161161

162162
def sha224?(string)
@@ -166,13 +166,13 @@ def sha224?(string)
166166
def sha224_file(filename, lite = false)
167167
require_relative '../../puppet/ssl/openssl_loader'
168168

169-
digest = OpenSSL::Digest::SHA224.new
169+
digest = OpenSSL::Digest.new('SHA224')
170170
checksum_file(digest, filename, lite)
171171
end
172172

173173
def sha224_stream(lite = false, &block)
174174
require_relative '../../puppet/ssl/openssl_loader'
175-
digest = OpenSSL::Digest::SHA224.new
175+
digest = OpenSSL::Digest.new('SHA224')
176176
checksum_stream(digest, block, lite)
177177
end
178178

lib/puppet/x509/cert_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def ca_last_update=(time)
182182
# @api private
183183
def save_private_key(name, key, password: nil)
184184
pem = if password
185-
cipher = OpenSSL::Cipher::AES.new(128, :CBC)
185+
cipher = OpenSSL::Cipher.new('aes-128-cbc')
186186
key.export(cipher, password)
187187
else
188188
key.to_pem

0 commit comments

Comments
 (0)