summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2023-09-08 10:33:24 +0200
committerBernd Edlinger <bernd.edlinger@hotmail.de>2023-09-09 16:48:49 +0200
commit913043f7f6b141712212fcebcdc1943038e5f82a (patch)
tree9784d9af3eaaf5957025230cfea0b769eb3b309e /test
parentd39402f7b909c9b5cc7eef7a633e14dccc90807d (diff)
Fix output corruption in req command
when used in conjunction with -out and -modulus options. Fixes #21403 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22026) (cherry picked from commit d2873946dfaff5537ea3d1adf3890e33a3f276ff)
Diffstat (limited to 'test')
-rw-r--r--test/recipes/25-test_req.t13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/recipes/25-test_req.t b/test/recipes/25-test_req.t
index 35541aed12..c41673509b 100644
--- a/test/recipes/25-test_req.t
+++ b/test/recipes/25-test_req.t
@@ -15,7 +15,7 @@ use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_req");
-plan tests => 44;
+plan tests => 46;
require_ok(srctop_file('test', 'recipes', 'tconversion.pl'));
@@ -473,3 +473,14 @@ my $cert = "self-signed_CA_with_keyUsages.pem";
generate_cert($cert, "-in", srctop_file(@certs, "ext-check.csr"),
"-copy_extensions", "copy");
has_keyUsage($cert, 1);
+
+# Generate cert using req with '-modulus'
+ok(run(app(["openssl", "req", "-x509", "-new", "-days", "365",
+ "-key", srctop_file("test", "testrsa.pem"),
+ "-config", srctop_file('test', 'test.cnf'),
+ "-out", "testreq-cert.pem",
+ "-modulus"])), "cert req creation - with -modulus");
+
+# Verify cert
+ok(run(app(["openssl", "x509", "-in", "testreq-cert.pem",
+ "-noout", "-text"])), "cert verification");