Skip to content

Commit

Permalink
(maint) Update test_ca
Browse files Browse the repository at this point in the history
Previously, the build_cert method in Puppet::TestCa needed special logic
for the Eliptical Curve class: ruby/openssl#29

This issue was resolved in OpenSSL 2.0, which was released in 2016,
meaning that all versions of Ruby that Puppet supports includes
Ruby/OpenSSL >= 2.0.

This commit removes special logic for EC in Puppet::TestCa.
  • Loading branch information
mhashizume committed Jun 27, 2023
1 parent bb6b9a2 commit 48a5769
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions spec/lib/puppet/test_ca.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,7 @@ def build_cert(name, issuer, opts = {})
key = OpenSSL::PKey::RSA.new(2048)
end
cert = OpenSSL::X509::Certificate.new
cert.public_key = if key.is_a?(OpenSSL::PKey::EC)
# EC#public_key doesn't following the PKey API,
# see https://github.com/ruby/openssl/issues/29
point = key.public_key
pubkey = OpenSSL::PKey::EC.new(point.group)
pubkey.public_key = point
pubkey
else
key.public_key
end
cert.public_key = key
cert.subject = OpenSSL::X509::Name.new([["CN", name]])
cert.issuer = issuer
cert.version = 2
Expand Down

0 comments on commit 48a5769

Please sign in to comment.