Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions 29 test/recipes/15-test_rsa.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use OpenSSL::Test::Utils;

setup("test_rsa");

plan tests => 17;
plan tests => 18;

require_ok(srctop_file('test', 'recipes', 'tconversion.pl'));

Expand All @@ -28,7 +28,32 @@ run_rsa_tests("pkey");
run_rsa_tests("rsa");

SKIP: {
skip "RSA is not supported in this build", 1 if disabled("rsa");
skip "RSA is not supported in this build", 2 if disabled("rsa");

subtest "rsa -modulus prints the RSA modulus" => sub {
plan tests => 2;

# The modulus (n) of the committed testrsa.pem / testrsapub.pem keypair.
my $expected = "Modulus=AADB7AA92E464F15711996166B4FF8BBE2301DFEE9D8"
. "B3596DC3C1A7DFCE7C87180170509FC84EFD17B5BB02CA5DD0A3228686B38"
. "0CB746F3CAE4CDFC8AE5D3D";

my @priv = run(app(['openssl', 'rsa', '-modulus', '-noout',
'-in', srctop_file("test", "testrsa.pem")],
stderr => undef),
capture => 1);
chomp @priv;
ok(grep(/^\Q$expected\E$/, @priv),
"-modulus prints the expected modulus for a private key");

my @pub = run(app(['openssl', 'rsa', '-pubin', '-modulus', '-noout',
'-in', srctop_file("test", "testrsapub.pem")],
stderr => undef),
capture => 1);
chomp @pub;
ok(grep(/^\Q$expected\E$/, @pub),
"-modulus prints the expected modulus for a public key");
};

subtest "rsa -text prints the key in text form" => sub {
plan tests => 6;
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.