]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/25-test_gen.t
Add version numbers on some modules we use.
[thirdparty/openssl.git] / test / recipes / 25-test_gen.t
CommitLineData
4650de3e
RL
1#! /usr/bin/perl
2
3use strict;
4use warnings;
5
6use File::Spec;
fb921436 7use Test::More 0.96;
4650de3e
RL
8use OpenSSL::Test qw/:DEFAULT top_file/;
9
10setup("test_gen");
11
12plan tests => 1;
13
14my $T = "testcert";
15my $KEY = 512;
16my $CA = top_file("certs", "testca.pem");
17
18unlink "$T.1", "$T.2", "$T.key";
19open RND, ">>", ".rnd";
20print RND "string to make the random number generator think it has entropy";
21close RND;
22
23subtest "generating certificate requests" => sub {
24 my @req_new;
25 if (run(app(["openssl", "no-rsa"], stdout => undef))) {
26 @req_new = ("-newkey", "dsa:".top_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", top_file("test", "test.cnf"),
38 @req_new, "-out", "testreq.pem"])),
39 "Generating request");
40
41 ok(run(app(["openssl", "req", "-config", top_file("test", "test.cnf"),
42 "-verify", "-in", "testreq.pem", "-noout"])),
43 "Verifying signature on request");
44};