2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (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
13 use OpenSSL::Test::Utils;
14 use OpenSSL::Test qw/:DEFAULT srctop_file/;
20 require_ok(srctop_file('test','recipes','tconversion.pl'));
22 open RND, ">>", ".rnd";
23 print RND "string to make the random number generator think it has entropy";
25 subtest "generating certificate requests" => sub {
27 if (disabled("rsa")) {
28 @req_new = ("-newkey", "dsa:".srctop_file("apps", "dsa512.pem"));
31 note("There should be a 2 sequences of .'s and some +'s.");
32 note("There should not be more that at most 80 per line");
37 ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
38 @req_new, "-out", "testreq.pem"])),
39 "Generating request");
41 ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
42 "-verify", "-in", "testreq.pem", "-noout"])),
43 "Verifying signature on request");
46 my @openssl_args = ("req", "-config", srctop_file("apps", "openssl.cnf"));
48 run_conversion('req conversions',
50 run_conversion('req conversions -- testreq2',
51 srctop_file("test", "testreq2.pem"));
53 unlink "testkey.pem", "testreq.pem";
59 subtest $title => sub {
60 run(app(["openssl", @openssl_args,
61 "-in", $reqfile, "-inform", "p",
63 stderr => "req-check.err", stdout => undef));
64 open DATA, "req-check.err";
66 plan skip_all => "skipping req conversion test for $reqfile"
67 if grep /Unknown Public Key/, map { s/\R//; } <DATA>;
69 tconversion("req", $reqfile, @openssl_args);
72 unlink "req-check.err";