15-test_dsa.t 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #! /usr/bin/env perl
  2. # Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use warnings;
  10. use File::Spec;
  11. use OpenSSL::Test qw/:DEFAULT srctop_file/;
  12. use OpenSSL::Test::Utils;
  13. setup("test_dsa");
  14. plan skip_all => 'DSA is not supported in this build' if disabled('dsa');
  15. plan tests => 7;
  16. require_ok(srctop_file('test','recipes','tconversion.pl'));
  17. ok(run(test(["dsatest"])), "running dsatest");
  18. ok(run(test(["dsa_no_digest_size_test"])),
  19. "running dsa_no_digest_size_test");
  20. subtest "dsa conversions using 'openssl dsa' -- private key" => sub {
  21. tconversion( -type => 'dsa', -prefix => 'dsa-priv',
  22. -in => srctop_file("test","testdsa.pem") );
  23. };
  24. subtest "dsa conversions using 'openssl dsa' -- public key" => sub {
  25. tconversion( -type => 'msb', -prefix => 'dsa-msb-pub',
  26. -in => srctop_file("test","testdsapub.pem"),
  27. -args => ["dsa", "-pubin", "-pubout"] );
  28. };
  29. subtest "dsa conversions using 'openssl pkey' -- private key PKCS#8" => sub {
  30. tconversion( -type => 'dsa', -prefix => 'dsa-pkcs8',
  31. -in => srctop_file("test","testdsa.pem"),
  32. -args => ["pkey"] );
  33. };
  34. subtest "dsa conversions using 'openssl pkey' -- public key" => sub {
  35. tconversion( -type => 'dsa', -prefix => 'dsa-pkey-pub',
  36. -in => srctop_file("test","testdsapub.pem"),
  37. -args => ["pkey", "-pubin", "-pubout"] );
  38. };