2 # Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
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
14 use OpenSSL::Test qw/:DEFAULT srctop_file/;
15 use OpenSSL::Test::Utils;
19 plan skip_all => "This test is unsupported in a no-dsa build"
24 ok(run(app([ 'openssl', 'genpkey', '-genparam',
26 '-pkeyopt', 'gindex:1',
27 '-pkeyopt', 'type:fips186_4',
29 "genpkey DSA params fips186_4 with verifiable g");
31 ok(run(app([ 'openssl', 'genpkey', '-genparam',
33 '-pkeyopt', 'type:fips186_4',
35 "genpkey DSA params fips186_4 with unverifiable g");
37 ok(run(app([ 'openssl', 'genpkey', '-genparam',
39 '-pkeyopt', 'type:fips186_2',
41 "genpkey DSA params fips186_2");
43 ok(!run(app([ 'openssl', 'genpkey', '-algorithm', 'DSA',
44 '-pkeyopt', 'type:group',
46 "genpkey DSA does not support groups");
48 ok(run(app([ 'openssl', 'genpkey', '-genparam',
50 '-pkeyopt', 'gindex:1',
51 '-pkeyopt', 'type:fips186_4',
52 '-out', 'dsagen.pem'])),
53 "genpkey DSA params fips186_4 PEM");
55 ok(run(app([ 'openssl', 'genpkey', '-genparam',
57 '-pkeyopt', 'gindex:1',
58 '-pkeyopt', 'pbits:2048',
59 '-pkeyopt', 'qbits:256',
60 '-pkeyopt', 'type:fips186_4',
62 '-out', 'dsagen.der'])),
63 "genpkey DSA params fips186_4 DER");
65 # The seed and counter should be the ones generated from the param generation
66 # Just put some dummy ones in to show it works.
67 ok(run(app([ 'openssl', 'genpkey',
68 '-paramfile', 'dsagen.der',
69 '-pkeyopt', 'gindex:1',
70 '-pkeyopt', 'hexseed:0102030405060708090A0B0C0D0E0F1011121314',
71 '-pkeyopt', 'pcounter:25',
73 "genpkey DSA fips186_4 with DER params");
75 ok(!run(app([ 'openssl', 'genpkey',
76 '-algorithm', 'DSA'])),
77 "genpkey DSA with no params should fail");