diff options
| author | Jakub Zelenka <[email protected]> | 2026-07-15 23:59:08 +0200 |
|---|---|---|
| committer | Norbert Pocs <[email protected]> | 2026-07-27 12:19:01 +0200 |
| commit | 7c59d28b1060509af998cd6e33152d48465e94fe (patch) | |
| tree | 1c0c18237a2fff21c5668b61b5b63da03cf78b95 | |
| parent | ci: accept uppercase hex in dispatch head_sha validation (diff) | |
| download | openssl-7c59d28b1060509af998cd6e33152d48465e94fe.tar.gz openssl-7c59d28b1060509af998cd6e33152d48465e94fe.zip | |
apps: cover the req -subj modification of an existing request
Add a subtest exercising the code path in the req app that rewrites the
subject of an existing certificate request loaded via -in, i.e. when
-subj is given without -new/-newkey/-x509.
Assisted-by: Claude:claude-opus-4-8
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Ryan Hooper <[email protected]>
MergeDate: Mon Jul 27 10:19:06 2026
(Merged from https://github.com/openssl/openssl/pull/31965)
| -rw-r--r-- | test/recipes/25-test_req.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/recipes/25-test_req.t b/test/recipes/25-test_req.t index a37686736fa..67ad5b7a17e 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 => 131; +plan tests => 132; require_ok(srctop_file('test', 'recipes', 'tconversion.pl')); @@ -321,6 +321,24 @@ subtest "generating certificate requests" => sub { "Verifying signature on request"); }; +subtest "modifying the subject of an existing certificate request" => sub { + plan tests => 3; + + my $req_in = srctop_file("test", "testreq2.pem"); + my $req_out = "testreq-modified-subj.pem"; + my $subj_out = "testreq-modified-subj.txt"; + + ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"), + "-in", $req_in, "-subj", "/CN=Modified Subject", + "-out", $req_out])), + "Modifying subject of certificate request"); + + run(app(["openssl", "req", "-in", $req_out, "-noout", "-subject", + "-out", $subj_out])); + test_file_contains("modified request", $subj_out, "CN=Modified Subject", 1); + test_file_contains("modified request", $subj_out, "CN=cn4", 0); +}; + subtest "generating SM2 certificate requests" => sub { plan tests => 4; |
