Lines Matching +full:5 +full:- +full:bit
2 # Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
24 my $fipsconf = srctop_file("test", "fips-and-base.cnf");
29 my $gen = shift; #2, 5 or something else (0 is "something else")?
37 if (-T $file) {
42 if ($firstline eq "-----BEGIN DH PARAMETERS-----") {
44 } elsif ($firstline eq "-----BEGIN X9.42 DH PARAMETERS-----") {
60 my @textdata = run(app(['openssl', 'dhparam', '-in', $file, '-noout',
61 '-text', '-inform', $format]), capture => 1);
73 if (defined $textdata[0] && $textdata[0] =~ /DH Parameters: \((\d+) bit\)/) {
77 if ($gen == 2 || $gen == 5) {
78 #For generators 2 and 5 the value appears on the same line
90 subtest "Read: 1024 bit PKCS3 params, generator 2, PEM file" => sub {
92 checkdhparams(data_file("pkcs3-2-1024.pem"), "PKCS3", 2, "PEM", 1024);
94 subtest "Read: 1024 bit PKCS3 params, generator 5, PEM file" => sub {
96 checkdhparams(data_file("pkcs3-5-1024.pem"), "PKCS3", 5, "PEM", 1024);
98 subtest "Read: 2048 bit PKCS3 params, generator 2, PEM file" => sub {
100 checkdhparams(data_file("pkcs3-2-2048.pem"), "PKCS3", 2, "PEM", 2048);
102 subtest "Read: 1024 bit X9.42 params, PEM file" => sub {
104 checkdhparams(data_file("x942-0-1024.pem"), "X9.42", 0, "PEM", 1024);
106 subtest "Read: 1024 bit PKCS3 params, generator 2, DER file" => sub {
108 checkdhparams(data_file("pkcs3-2-1024.der"), "PKCS3", 2, "DER", 1024);
110 subtest "Read: 1024 bit PKCS3 params, generator 5, DER file" => sub {
112 checkdhparams(data_file("pkcs3-5-1024.der"), "PKCS3", 5, "DER", 1024);
114 subtest "Read: 2048 bit PKCS3 params, generator 2, DER file" => sub {
116 checkdhparams(data_file("pkcs3-2-2048.der"), "PKCS3", 2, "DER", 2048);
118 subtest "Read: 1024 bit X9.42 params, DER file" => sub {
119 checkdhparams(data_file("x942-0-1024.der"), "X9.42", 0, "DER", 1024);
124 subtest "Generate: 512 bit PKCS3 params, generator 2, PEM file" => sub {
125 plan tests => 5;
126 ok(run(app([ 'openssl', 'dhparam', '-out', 'gen-pkcs3-2-512.pem',
128 checkdhparams("gen-pkcs3-2-512.pem", "PKCS3", 2, "PEM", 512);
130 subtest "Generate: 512 bit PKCS3 params, explicit generator 2, PEM file" => sub {
131 plan tests => 5;
132 ok(run(app([ 'openssl', 'dhparam', '-out', 'gen-pkcs3-exp2-512.pem', '-2',
134 checkdhparams("gen-pkcs3-exp2-512.pem", "PKCS3", 2, "PEM", 512);
136 subtest "Generate: 512 bit PKCS3 params, generator 5, PEM file" => sub {
137 plan tests => 5;
138 ok(run(app([ 'openssl', 'dhparam', '-out', 'gen-pkcs3-5-512.pem', '-5',
140 checkdhparams("gen-pkcs3-5-512.pem", "PKCS3", 5, "PEM", 512);
142 subtest "Generate: 512 bit PKCS3 params, generator 2, explicit PEM file" => sub {
143 plan tests => 5;
144 ok(run(app([ 'openssl', 'dhparam', '-out', 'gen-pkcs3-2-512.exp.pem',
145 '-outform', 'PEM', '512' ])));
146 checkdhparams("gen-pkcs3-2-512.exp.pem", "PKCS3", 2, "PEM", 512);
151 subtest "Generate: 512 bit X9.42 params, generator 0, PEM file" => sub {
152 plan tests => 5;
153 ok(run(app([ 'openssl', 'dhparam', '-out', 'gen-x942-0-512.pem',
154 '-dsaparam', '512' ])));
155 checkdhparams("gen-x942-0-512.pem", "X9.42", 0, "PEM", 512);
157 subtest "Generate: 512 bit X9.42 params, explicit generator 2, PEM file" => sub {
159 #Expected to fail - you cannot select a generator with '-dsaparam'
160 ok(!run(app([ 'openssl', 'dhparam', '-out', 'gen-x942-exp2-512.pem', '-2',
161 '-dsaparam', '512' ])));
163 subtest "Generate: 512 bit X9.42 params, generator 5, PEM file" => sub {
165 #Expected to fail - you cannot select a generator with '-dsaparam'
166 ok(!run(app([ 'openssl', 'dhparam', '-out', 'gen-x942-5-512.pem',
167 '-5', '-dsaparam', '512' ])));
169 subtest "Generate: 512 bit X9.42 params, generator 0, DER file" => sub {
170 plan tests => 5;
171 ok(run(app([ 'openssl', 'dhparam', '-out', 'gen-x942-0-512.der',
172 '-dsaparam', '-outform', 'DER', '512' ])));
173 checkdhparams("gen-x942-0-512.der", "X9.42", 0, "DER", 512);
178 "checks", 4 if (disabled("fips") || disabled("fips-securitychecks"));
182 ok(!run(app(['openssl', 'dhparam', '-check', '512'])),
183 "Generating 512 bit DH params should fail in FIPS mode");
185 ok(run(app(['openssl', 'dhparam', '-provider', 'default', '-propquery',
186 '?fips!=yes', '-check', '512'])),
187 "Generating 512 bit DH params should succeed in FIPS mode using".
188 " non-FIPS property query");
193 ok(!run(app(['openssl', 'dhparam', '-dsaparam', '-check', '512'])),
194 "Generating 512 bit DSA-style DH params should fail in FIPS mode");
196 ok(run(app(['openssl', 'dhparam', '-provider', 'default', '-propquery',
197 '?fips!=yes', '-dsaparam', '-check', '512'])),
198 "Generating 512 bit DSA-style DH params should succeed in FIPS".
199 " mode using non-FIPS property query");
205 ok(run(app(["openssl", "dhparam", "-noout", "-text"],
206 stdin => data_file("pkcs3-2-1024.pem"))),