Commit fc73636888 for openssl.org
commit fc736368881368886501d432e3c0f5a1d3fbabce
Author: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Date: Mon Jun 15 18:24:28 2026 +0200
test/recipes/15-test_pkey.t: extend tests for openssl pkey -text and -text_pub
This slightly improves openssl pkey text coverage.
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Sun Jun 28 17:42:46 2026
(Merged from https://github.com/openssl/openssl/pull/31521)
diff --git a/test/recipes/15-test_pkey.t b/test/recipes/15-test_pkey.t
index c61b0548a3..7d36e0e83d 100644
--- a/test/recipes/15-test_pkey.t
+++ b/test/recipes/15-test_pkey.t
@@ -112,20 +112,32 @@ subtest "=== pkey handling of DER encoding ===" => sub {
"Same file contents after converting to DER and back");
};
-subtest "=== pkey text output ===" => sub {
- plan tests => 3;
+subtest "=== pkey text and text_pub output ===" => sub {
+ plan tests => 6;
ok((grep /BEGIN PRIVATE KEY/,
run(app([@app, '-in', $in_key, '-text']), capture => 1)),
"pkey text output contains PEM header");
ok(!(grep /BEGIN PRIVATE KEY/,
- run(app([@app, '-in', $in_key, '-text', '-noout']), capture => 1)),
- "pkey text output with -noout does not contain PEM header");
+ run(app([@app, '-in', $in_key, '-text', '-noout']), capture => 1)),
+ "pkey text output with -noout does not contain PEM header");
ok((grep /Private-Key:/,
run(app([@app, '-in', $in_key, '-text', '-noout']), capture => 1)),
"pkey text output (even with -noout) contains \"Private-Key:\"");
+
+ ok(!(grep /Private-Key:/,
+ run(app([@app, '-in', $in_key, '-text_pub', '-noout']), capture => 1)),
+ "-text_pub does not print private key components");
+
+ ok((grep /Public-Key:/,
+ run(app([@app, '-in', $in_key, '-text_pub', '-noout']), capture => 1)),
+ "-text_pub prints public key components");
+
+ ok(!run(app([@app, '-in', $in_key, '-text', '-outform', 'DER',
+ '-out', 'text_der.tmp'])),
+ "-text combined with DER output is rejected");
};
subtest "=== pkey EC point conversion form ===" => sub {