From 0c85cc506916039bba86e8335aa71e0e44f038b0 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 17 Apr 2015 20:13:58 +0200 Subject: [PATCH] Add asymetric cipher test recipes Some of them make use of recipes/tconversion.pl. Reviewed-by: Rich Salz --- test/recipes/15-test_dh.t | 12 ++++++++++++ test/recipes/15-test_dsa.t | 33 +++++++++++++++++++++++++++++++++ test/recipes/15-test_ec.t | 31 +++++++++++++++++++++++++++++++ test/recipes/15-test_ecdh.t | 12 ++++++++++++ test/recipes/15-test_ecdsa.t | 12 ++++++++++++ test/recipes/15-test_rsa.t | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 132 insertions(+) create mode 100644 test/recipes/15-test_dh.t create mode 100644 test/recipes/15-test_dsa.t create mode 100644 test/recipes/15-test_ec.t create mode 100644 test/recipes/15-test_ecdh.t create mode 100644 test/recipes/15-test_ecdsa.t create mode 100644 test/recipes/15-test_rsa.t diff --git a/test/recipes/15-test_dh.t b/test/recipes/15-test_dh.t new file mode 100644 index 0000000000..957df4a739 --- /dev/null +++ b/test/recipes/15-test_dh.t @@ -0,0 +1,12 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use OpenSSL::Test; + +setup("test_dh"); + +plan tests => 1; +ok(run(test(["dhtest"])), "running dhtest"); diff --git a/test/recipes/15-test_dsa.t b/test/recipes/15-test_dsa.t new file mode 100644 index 0000000000..897e4480cb --- /dev/null +++ b/test/recipes/15-test_dsa.t @@ -0,0 +1,33 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use File::Spec; +use Test::More; +use OpenSSL::Test qw/:DEFAULT top_file/; + +setup("test_dsa"); + +plan tests => 6; + +require_ok(top_file('test','recipes','tconversion.pl')); + +ok(run(test(["dsatest"])), "running dsatest"); +ok(run(test(["dsatest", "-app2_1"])), "running dsatest -app2_1"); + + SKIP: { + skip "Skipping dsa conversion test", 3 + if run(app(["openssl","no-dsa"], stdout => undef)); + + subtest 'dsa conversions -- private key' => sub { + tconversion("dsa", top_file("test","testdsa.pem")); + }; + subtest 'dsa conversions -- private key PKCS#8' => sub { + tconversion("dsa", top_file("test","testdsa.pem"), "pkey"); + }; + subtest 'dsa conversions -- public key' => sub { + tconversion("dsa", top_file("test","testdsapub.pem"), "dsa", + "-pubin", "-pubout"); + }; +} diff --git a/test/recipes/15-test_ec.t b/test/recipes/15-test_ec.t new file mode 100644 index 0000000000..6619a480d3 --- /dev/null +++ b/test/recipes/15-test_ec.t @@ -0,0 +1,31 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use File::Spec; +use Test::More; +use OpenSSL::Test qw/:DEFAULT top_file/; + +setup("test_ec"); + +plan tests => 5; + +require_ok(top_file('test','recipes','tconversion.pl')); + +ok(run(test(["ectest"])), "running ectest"); + + SKIP: { + skip "Skipping ec conversion test", 3 + if run(app(["openssl","no-ec"], stdout => undef)); + + subtest 'ec conversions -- private key' => sub { + tconversion("ec", top_file("test","testec-p256.pem")); + }; + subtest 'ec conversions -- private key PKCS#8' => sub { + tconversion("ec", top_file("test","testec-p256.pem"), "pkey"); + }; + subtest 'ec conversions -- public key' => sub { + tconversion("ec", top_file("test","testecpub-p256.pem"), "ec", "-pubin", "-pubout"); + }; +} diff --git a/test/recipes/15-test_ecdh.t b/test/recipes/15-test_ecdh.t new file mode 100644 index 0000000000..4c0d97e729 --- /dev/null +++ b/test/recipes/15-test_ecdh.t @@ -0,0 +1,12 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use OpenSSL::Test; + +setup("test_ecdh"); + +plan tests => 1; +ok(run(test(["ecdhtest"])), "running ecdhtest"); diff --git a/test/recipes/15-test_ecdsa.t b/test/recipes/15-test_ecdsa.t new file mode 100644 index 0000000000..2cd144b305 --- /dev/null +++ b/test/recipes/15-test_ecdsa.t @@ -0,0 +1,12 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use OpenSSL::Test; + +setup("test_ecdsa"); + +plan tests => 1; +ok(run(test(["ecdsatest"])), "running ecdsatest"); diff --git a/test/recipes/15-test_rsa.t b/test/recipes/15-test_rsa.t new file mode 100644 index 0000000000..9b17fbef9d --- /dev/null +++ b/test/recipes/15-test_rsa.t @@ -0,0 +1,32 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use File::Spec; +use Test::More; +use OpenSSL::Test qw/:DEFAULT top_file/; + +setup("test_rsa"); + +plan tests => 5; + +require_ok(top_file('test','recipes','tconversion.pl')); + +ok(run(test(["rsa_test"])), "running rsatest"); + + SKIP: { + skip "Skipping rsa conversion test", 3 + if run(app(["openssl","no-rsa"], stdout => undef)); + + subtest 'rsa conversions -- private key' => sub { + tconversion("rsa", top_file("test","testrsa.pem")); + }; + subtest 'rsa conversions -- private key PKCS#8' => sub { + tconversion("rsa", top_file("test","testrsa.pem"), "pkey"); + }; + subtest 'rsa conversions -- public key' => sub { + tconversion("rsa", top_file("test","testrsapub.pem"), "rsa", + "-pubin", "-pubout"); + }; +} -- 2.25.1