Skip to content

Commit

Permalink
Merge pull request #244 from marcusdots/pkcs12_validity_tests
Browse files Browse the repository at this point in the history
openssl::export::pkcs12: Enhance acceptance tests with openssl validation
  • Loading branch information
bastelfreak authored Feb 10, 2025
2 parents bda0310 + 58363ef commit b8c0c10
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/acceptance/pkcs12_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,20 @@
describe file('/tmp/export4.pkcs12.p12') do
its(:size) { is_expected.to be > 0 }
end

if fact('openssl_version').split('.').first.to_i > 1
describe command('openssl pkcs12 -info -in /tmp/export3.pkcs12.p12 -passin pass: -passout pass:') do
its(:stdout) { is_expected.to contain('-----BEGIN CERTIFICATE-----') }
its(:stdout) { is_expected.to contain('-----BEGIN ENCRYPTED PRIVATE KEY-----') }
its(:exit_status) { is_expected.to eq 0 }
end

describe command('openssl pkcs12 -info -in /tmp/export.pkcs12.p12 -passin pass:mahje1Qu -passout pass:') do
its(:stdout) { is_expected.to contain('-----BEGIN CERTIFICATE-----') }
its(:stdout) { is_expected.to contain('-----BEGIN ENCRYPTED PRIVATE KEY-----') }
its(:exit_status) { is_expected.to eq 0 }
end
end

# rubocop:enable RSpec/RepeatedExampleGroupBody
end

0 comments on commit b8c0c10

Please sign in to comment.