xref: /freebsd/crypto/openssl/test/recipes/15-test_dsa.t (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
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
9
10use strict;
11use warnings;
12
13use File::Spec;
14use OpenSSL::Test qw/:DEFAULT srctop_file/;
15use OpenSSL::Test::Utils;
16
17setup("test_dsa");
18
19plan skip_all => 'DSA is not supported in this build' if disabled('dsa');
20plan tests => 7;
21
22require_ok(srctop_file('test','recipes','tconversion.pl'));
23
24ok(run(test(["dsatest"])), "running dsatest");
25ok(run(test(["dsa_no_digest_size_test"])),
26   "running dsa_no_digest_size_test");
27
28subtest "dsa conversions using 'openssl dsa' -- private key" => sub {
29    tconversion( -type => 'dsa', -prefix => 'dsa-priv',
30                 -in => srctop_file("test","testdsa.pem") );
31};
32subtest "dsa conversions using 'openssl dsa' -- public key" => sub {
33    tconversion( -type => 'msb', -prefix => 'dsa-msb-pub',
34                 -in => srctop_file("test","testdsapub.pem"),
35                 -args => ["dsa", "-pubin", "-pubout"] );
36};
37
38subtest "dsa conversions using 'openssl pkey' -- private key PKCS#8" => sub {
39    tconversion( -type => 'dsa', -prefix => 'dsa-pkcs8',
40                 -in => srctop_file("test","testdsa.pem"),
41                 -args => ["pkey"] );
42};
43subtest "dsa conversions using 'openssl pkey' -- public key" => sub {
44    tconversion( -type => 'dsa', -prefix => 'dsa-pkey-pub',
45                 -in => srctop_file("test","testdsapub.pem"),
46                 -args => ["pkey", "-pubin", "-pubout"] );
47};
48