Fix minor errors in the afalg test
[openssl.git] / test / recipes / 25-test_gen.t
1 #! /usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use File::Spec;
7 use OpenSSL::Test qw/:DEFAULT srctop_file/;
8 use OpenSSL::Test::Utils;
9
10 setup("test_gen");
11
12 plan tests => 1;
13
14 my $T = "testcert";
15 my $KEY = 512;
16 my $CA = srctop_file("certs", "testca.pem");
17
18 unlink "$T.1", "$T.2", "$T.key";
19 open RND, ">>", ".rnd";
20 print RND "string to make the random number generator think it has entropy";
21 close RND;
22
23 subtest "generating certificate requests" => sub {
24     my @req_new;
25     if (disabled("rsa")) {
26         @req_new = ("-newkey", "dsa:".srctop_file("apps", "dsa512.pem"));
27     } else {
28         @req_new = ("-new");
29         note("There should be a 2 sequences of .'s and some +'s.");
30         note("There should not be more that at most 80 per line");
31     }
32
33     unlink "testkey.pem", "testreq.pem";
34
35     plan tests => 2;
36
37     ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
38                 @req_new, "-out", "testreq.pem"])),
39        "Generating request");
40
41     ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
42                 "-verify", "-in", "testreq.pem", "-noout"])),
43        "Verifying signature on request");
44 };