aa8c75a93a1a3720495406bbf433e96b4f0ad7b9
[openssl.git] / test / recipes / 15-test_dsa.t
1 #! /usr/bin/env perl
2 # Copyright 2015-2018 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
9
10 use strict;
11 use warnings;
12
13 use File::Spec;
14 use OpenSSL::Test qw/:DEFAULT srctop_file/;
15 use OpenSSL::Test::Utils;
16
17 setup("test_dsa");
18
19 plan skip_all => 'DSA is not supported in this build' if disabled('dsa');
20 plan tests => 7;
21
22 my $deprecated_dsa =
23     disabled('deprecated') || !defined config('api') || config('api') >= 30000;
24
25 require_ok(srctop_file('test','recipes','tconversion.pl'));
26
27  SKIP: {
28      skip "Skipping initial dsa tests", 2
29          if $deprecated_dsa;
30
31      ok(run(test(["dsatest"])), "running dsatest");
32      ok(run(test(["dsa_no_digest_size_test"])),
33         "running dsa_no_digest_size_test");
34 }
35
36  SKIP: {
37      skip "Skipping dsa conversion test using 'openssl dsa'", 2
38          if $deprecated_dsa;
39
40      subtest "dsa conversions using 'openssl dsa' -- private key"> sub {
41          tconversion("dsa", srctop_file("test","testdsa.pem"));
42      };
43      subtest "dsa conversions using 'openssl dsa' -- public key" => sub {
44          tconversion("msb", srctop_file("test","testdsapub.pem"), "dsa",
45                      "-pubin", "-pubout");
46      };
47 }
48
49 subtest "dsa conversions using 'openssl pkey' -- private key PKCS#8" => sub {
50     tconversion("dsa", srctop_file("test","testdsa.pem"), "pkey");
51 };
52 subtest "dsa conversions using 'openssl pkey' -- public key" => sub {
53     tconversion("dsa", srctop_file("test","testdsapub.pem"), "pkey",
54                 "-pubin", "-pubout");
55 };