Commit 5ff6cdcd authored by Julien Huon's avatar Julien Huon
Browse files

Fix ec_public_key with documentation & tests


Signed-off-by: default avatarJulien Huon <juju482@gmail.com>
parent 57c3bcf3
......@@ -13,9 +13,9 @@ default_action :create
action :create do
raise ArgumentError, "You cannot specify both 'private_key_path' and 'private_key_content' properties at the same time." if new_resource.private_key_path && new_resource.private_key_content
raise ArgumentError, "You must specify the private key with either 'private_key_path' or 'private_key_content' properties." unless new_resource.private_key_path || new_resource.private_key_content
raise "#{new_resource.private_key_path} not a valid private RSA key or password is invalid" unless priv_key_file_valid?((new_resource.private_key_path || new_resource.private_key_content), new_resource.private_key_pass)
raise "#{new_resource.private_key_path} not a valid private EC key or password is invalid" unless priv_key_file_valid?((new_resource.private_key_path || new_resource.private_key_content), new_resource.private_key_pass)
ec_key_content = gen_ec_public_key((new_resource.private_key_path || new_resource.private_key_content), new_resource.private_key_pass)
ec_key_content = gen_ec_pub_key((new_resource.private_key_path || new_resource.private_key_content), new_resource.private_key_pass)
file new_resource.name do
action :create
......
......@@ -21,7 +21,12 @@
%w(
/etc/ssl_test/rsakey_des3.pem
/etc/ssl_test/rsakey_aes128cbc.pem
/etc/ssl_test/private_key.pem
/etc/ssl_test/rsakey_des3.pub
/etc/ssl_test/rsakey_2.pub
/etc/ssl_test/eckey_prime256v1_des3.pem
/etc/ssl_test/eckey_prime256v1_des3.pub
/etc/ssl_test/eckey_prime256v1_des3_2.pub
/etc/ssl_test/dhparam.pem
/etc/ssl_test/mycert.crt
/etc/ssl_test/mycert.key
......@@ -110,6 +115,17 @@ openssl_ec_private_key '/etc/ssl_test/eckey_prime256v1_des3.pem' do
action :create
end
openssl_ec_public_key '/etc/ssl_test/eckey_prime256v1_des3.pub' do
private_key_path '/etc/ssl_test/eckey_prime256v1_des3.pem'
private_key_pass 'something'
action :create
end
openssl_ec_public_key '/etc/ssl_test/eckey_prime256v1_des3_2.pub' do
private_key_content "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEII2VAU9re44mAUzYPWCg+qqwdmP8CplsEg0b/DYPXLg2oAoGCCqGSM49\nAwEHoUQDQgAEKkpMCbIQ2C6Qlp/B+Odp1a9Y06Sm8yqPvCVIkWYP7M8PX5+RmoIv\njGBVf/+mVBx77ji3NpTilMUt2KPZ87lZ3w==\n-----END EC PRIVATE KEY-----\n"
action :create
end
#
# X509_CERTIFICATE HERE
#
......
......@@ -15,6 +15,19 @@ describe command('openssl ec -in /etc/ssl_test/eckey_prime256v1_des3.pem -text -
its('stdout') { should match /prime256v1/ }
end
describe command('openssl ec -in /etc/ssl_test/eckey_prime256v1_des3.pem -pubout -out /tmp/ec_pub && diff /etc/ssl_test/eckey_prime256v1_des3.pub /tmp/ec_pub') do
its('exit_status') { should eq 0 }
end
describe command('openssl ec -in /etc/ssl_test/eckey_prime256v1_des3v2.pem -text -noout -passin pass:"something"') do
its('exit_status') { should eq 0 }
its('stdout') { should match /prime256v1/ }
end
describe command('openssl ec -in /etc/ssl_test/eckey_prime256v1_des3v2.pem -pubout -out /tmp/ec_pub && diff /etc/ssl_test/eckey_prime256v1_des3v2.pub /tmp/ec_pub') do
its('exit_status') { should eq 0 }
end
describe command('openssl dhparam -in /etc/ssl_test/dhparam.pem -check -noout') do
its('exit_status') { should eq 0 }
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment