|
198 | 198 |
|
199 | 199 | expect do
|
200 | 200 | request.generate(key, :csr_attributes => csr_attributes)
|
201 |
| - end.to raise_error Puppet::Error, /Cannot create CSR with attribute thats\.no\.moon: first num too large/ |
| 201 | + end.to raise_error Puppet::Error, /Cannot create CSR with attribute thats\.no\.moon: / |
202 | 202 | end
|
203 | 203 |
|
204 | 204 | it "should support old non-DER encoded extensions" do
|
|
271 | 271 | exts = {"thats.no.moon" => "death star"}
|
272 | 272 | expect do
|
273 | 273 | request.generate(key, :extension_requests => exts)
|
274 |
| - end.to raise_error Puppet::Error, /Cannot create CSR with extension request thats\.no\.moon.*: first num too large/ |
| 274 | + end.to raise_error Puppet::Error, /Cannot create CSR with extension request thats\.no\.moon.*: / |
275 | 275 | end
|
276 | 276 | end
|
277 | 277 |
|
|
313 | 313 |
|
314 | 314 | it "should use SHA1 to sign the csr when SHA256 isn't available" do
|
315 | 315 | csr = OpenSSL::X509::Request.new
|
| 316 | + csr.public_key = key.public_key |
316 | 317 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA256").and_return(false)
|
317 | 318 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(true)
|
318 | 319 | signer = Puppet::SSL::CertificateSigner.new
|
|
323 | 324 | it "should use SHA512 to sign the csr when SHA256 and SHA1 aren't available" do
|
324 | 325 | key = OpenSSL::PKey::RSA.new(2048)
|
325 | 326 | csr = OpenSSL::X509::Request.new
|
| 327 | + csr.public_key = key.public_key |
326 | 328 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA256").and_return(false)
|
327 | 329 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(false)
|
328 | 330 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA512").and_return(true)
|
|
334 | 336 | it "should use SHA384 to sign the csr when SHA256/SHA1/SHA512 aren't available" do
|
335 | 337 | key = OpenSSL::PKey::RSA.new(2048)
|
336 | 338 | csr = OpenSSL::X509::Request.new
|
| 339 | + csr.public_key = key.public_key |
337 | 340 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA256").and_return(false)
|
338 | 341 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(false)
|
339 | 342 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA512").and_return(false)
|
|
345 | 348 |
|
346 | 349 | it "should use SHA224 to sign the csr when SHA256/SHA1/SHA512/SHA384 aren't available" do
|
347 | 350 | csr = OpenSSL::X509::Request.new
|
| 351 | + csr.public_key = key.public_key |
348 | 352 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA256").and_return(false)
|
349 | 353 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(false)
|
350 | 354 | expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA512").and_return(false)
|
|
0 commit comments