-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from bastelfreak/pfx
openssl::export::pem_key: Add acceptance tests
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
openssl::certificate::x509 { 'export_pem_from_pkcs12.example.com': | ||
ensure => present, | ||
country => 'CH', | ||
organization => 'Example.com', | ||
commonname => 'export_pem_from_pkcs12.example.com', | ||
base_dir => '/tmp', | ||
owner => 'nobody', | ||
# This is just to speed up CI - use 2048 or more in production | ||
key_size => 1024, | ||
} | ||
-> openssl::export::pkcs12 { 'export1_pem_from_pkcs12.pkcs12': | ||
ensure => 'present', | ||
basedir => '/tmp', | ||
pkey => '/tmp/export_pem_from_pkcs12.example.com.key', | ||
cert => '/tmp/export_pem_from_pkcs12.example.com.crt', | ||
out_pass => 'mahje1Qu', | ||
} | ||
-> openssl::export::pkcs12 { 'export2_pem_from_pkcs12.pkcs12': | ||
ensure => 'present', | ||
basedir => '/tmp', | ||
pkey => '/tmp/export_pem_from_pkcs12.example.com.key', | ||
cert => '/tmp/export_pem_from_pkcs12.example.com.crt', | ||
} | ||
# import pkcs12 without pass, generate pem with pass | ||
-> openssl::export::pem_key { '/tmp/export1_pem_from_pkcs12.pem': | ||
pfx_cert => '/tmp/export2_pem_from_pkcs12.pkcs12.p12', | ||
out_pass => 'mahje1Qu', | ||
} | ||
# import pkcs12 with pass, generate pem with pass | ||
-> openssl::export::pem_key { '/tmp/export2_pem_from_pkcs12.pem': | ||
pfx_cert => '/tmp/export1_pem_from_pkcs12.pkcs12.p12', | ||
in_pass => 'mahje1Qu', | ||
out_pass => 'mahje1Qu', | ||
} | ||
# import pkcs12 with pass, generate pem without pass | ||
-> openssl::export::pem_key { '/tmp/export3_pem_from_pkcs12.pem': | ||
pfx_cert => '/tmp/export1_pem_from_pkcs12.pkcs12.p12', | ||
in_pass => 'mahje1Qu', | ||
} | ||
# import pkcs12 without pass, generate pem without pass | ||
-> openssl::export::pem_key { '/tmp/export4_pem_from_pkcs12.pem': | ||
pfx_cert => '/tmp/export2_pem_from_pkcs12.pkcs12.p12', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'pkcs12 example' do | ||
it_behaves_like 'the example', 'export_pem_from_pkcs12.pp' do | ||
it { expect(file('/tmp/export_pem_from_pkcs12.example.com.crt')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) } | ||
it { expect(file('/tmp/export_pem_from_pkcs12.example.com.key')).to be_file.and(have_attributes(owner: 'nobody', group: 'root')) } | ||
it { expect(file('/tmp/export1_pem_from_pkcs12.pkcs12.p12')).to be_file.and(have_attributes(owner: 'root', group: 'root')) } | ||
it { expect(file('/tmp/export2_pem_from_pkcs12.pkcs12.p12')).to be_file.and(have_attributes(owner: 'root', group: 'root')) } | ||
it { expect(file('/tmp/export3_pem_from_pkcs12.pkcs12.p12')).to be_file.and(have_attributes(owner: 'root', group: 'root')) } | ||
it { expect(file('/tmp/export4_pem_from_pkcs12.pkcs12.p12')).to be_file.and(have_attributes(owner: 'root', group: 'root')) } | ||
end | ||
# rubocop:disable RSpec/RepeatedExampleGroupBody | ||
describe file('/tmp/export1_pem_from_pkcs12.pkcs12.p12') do | ||
its(:size) { is_expected.to be > 0 } | ||
end | ||
|
||
describe file('/tmp/export2_pem_from_pkcs12.pkcs12.p12') do | ||
its(:size) { is_expected.to be > 0 } | ||
end | ||
|
||
describe file('/tmp/export3_pem_from_pkcs12.pkcs12.p12') do | ||
its(:size) { is_expected.to be > 0 } | ||
end | ||
|
||
describe file('/tmp/export4_pem_from_pkcs12.pkcs12.p12') do | ||
its(:size) { is_expected.to be > 0 } | ||
end | ||
# rubocop:enable RSpec/RepeatedExampleGroupBody | ||
end |