Skip to content
Snippets Groups Projects
Commit be8cbd4fd4e0 authored by Kenneth Chu's avatar Kenneth Chu
Browse files

Refactor how the key size is determined

parent 822d616db7aa
2 merge requests!51Validate shift of Heptapod 0.25 to oldstable series,!44GitLab 14.0
......@@ -24,7 +24,7 @@
if ::File.file?("#{new_resource.key}-staging")
staging_key = OpenSSL::PKey::RSA.new ::File.read "#{new_resource.key}-staging"
staging_key_size = staging_key.to_text.split(/\n/).first[/[0-9]* bit/].split.first.to_i
staging_key_size = staging_key.n.num_bits
if new_resource.key_size.nil?
unless staging_key_size == node['acme']['key_size']
......@@ -68,7 +68,7 @@
if ::File.file?(new_resource.key)
production_key = OpenSSL::PKey::RSA.new ::File.read new_resource.key
production_key_size = production_key.to_text.split(/\n/).first[/[0-9]* bit/].split.first.to_i
production_key_size = production_key.n.num_bits
if new_resource.key_size.nil?
unless production_key_size == node['acme']['key_size']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment