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