Skip to content

Commit 8ffb44c

Browse files
(PUP-11716) Account for different jruby and mri openssl implementations
In mri openssl, calling `sign(wrong_key, digest)` will update the public key contained in the certificate and generate a new signature using the private wrong_key. In jruby, it is assumed that the public key has already been set.
1 parent a4d7b3f commit 8ffb44c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

spec/unit/ssl/ssl_provider_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@
299299
end
300300

301301
it 'raises if client cert signature is invalid' do
302+
client_cert.public_key = wrong_key.public_key
302303
client_cert.sign(wrong_key, OpenSSL::Digest::SHA256.new)
303304
expect {
304305
subject.create_context(**config.merge(client_cert: client_cert))
@@ -339,6 +340,7 @@
339340

340341
it 'raises if intermediate CA signature is invalid' do
341342
int = global_cacerts.last
343+
int.public_key = wrong_key.public_key if Puppet::Util::Platform.jruby?
342344
int.sign(wrong_key, OpenSSL::Digest::SHA256.new)
343345

344346
expect {

0 commit comments

Comments
 (0)