]>
Commit | Line | Data |
---|---|---|
4650de3e RL |
1 | #! /usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use File::Spec; | |
fb921436 | 7 | use Test::More 0.96; |
4650de3e RL |
8 | use OpenSSL::Test qw/:DEFAULT top_file/; |
9 | ||
10 | setup("test_gen"); | |
11 | ||
12 | plan tests => 1; | |
13 | ||
14 | my $T = "testcert"; | |
15 | my $KEY = 512; | |
16 | my $CA = top_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 (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 | }; |