From 027211787a0388bae578f153e7b15b4eb30f352e Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Thu, 23 Feb 2017 16:22:10 -0600 Subject: [PATCH] Add AGL's "beer mug" PEM file as another test input AGL has a history of pointing out the idiosynchronies/laxness of the openssl PEM parser in amusing ways. If we want this functionality to stay present, we should test that it works. Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/2756) (cherry picked from commit a00b9560f7ece1e51bd7a8dc6a7ffb7a3d20cf86) --- test/recipes/04-test_pem.t | 9 ++++++- test/recipes/04-test_pem_data/beermug.pem | 30 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/recipes/04-test_pem_data/beermug.pem diff --git a/test/recipes/04-test_pem.t b/test/recipes/04-test_pem.t index 291f2ba3da..23d1ef8a93 100644 --- a/test/recipes/04-test_pem.t +++ b/test/recipes/04-test_pem.t @@ -76,7 +76,7 @@ my %dsa_expected = ( "dsa.pem" => 1 ); -plan tests => scalar keys(%cert_expected) + scalar keys(%dsa_expected); +plan tests => scalar keys(%cert_expected) + scalar keys(%dsa_expected) + 1; foreach my $input (keys %cert_expected) { my @common = ($cmd, "x509", "-text", "-noout", "-inform", "PEM", "-in"); @@ -93,3 +93,10 @@ SKIP: { is((scalar @match > 0 ? 1 : 0), $dsa_expected{$input}); } } +SKIP: { + skip "RSA support disabled, skipping...", 1 unless !disabled("rsa"); + my @common = ($cmd, "pkey", "-inform", "PEM", "-noout", "-text", "-in"); + my @data = run(app([@common, data_file("beermug.pem")], stderr => undef), capture => 1); + my @match = grep /00:a0:3a:21:14:5d:cd:b6:d5:a0:3e:49:23:c1:3a:/, @data; + ok(scalar @match > 0 ? 1 : 0); +} diff --git a/test/recipes/04-test_pem_data/beermug.pem b/test/recipes/04-test_pem_data/beermug.pem new file mode 100644 index 0000000000..98b04b7325 --- /dev/null +++ b/test/recipes/04-test_pem_data/beermug.pem @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC+qeXl4ZUfQZFmcGAPwdt7Mza4NQ6mJHehc4V/hVYc6eepvL/5 +uyyflzuhVy5ufctdi92FlXcIct5nNPdqK0PPdWH5Uzw0t/OjI5y/SJh8ur20krqw +j/N1IOs63AcGLIVSkwx89iQbxj+2tV+YxFpGunUYyR/bJJWczuDMA/CujQIDAQAB +AoGBAKA6IRRdzbbVoD5JI8E6NZtEP7DwDZ57uPk6Hq86u1JTEzcmguJ4dJitPBRr +Mn7yQgwcNQ5EvCKifdqXvXBAaZuiiPFuCS/gfUw04jVHXWvG8ZvBQC3dutUYnFW7 +hdun8QU/Z6a1BethvESi1J1vgY2+XC4cBIvbutTc9HhMhbQ1AkEA8YTKGsVEYoKE +d7sSx4qjeN4bgzeVgIwRt01wJ1EJN62LhwO+pYSXvTt14aHxiascejJqUhtuWvzR +nuwydqiDpwJBAMoYgUoWdgW4O/C5ZXjiSia54jzrt7upxSq88njTRo/MCQfuJVbc +3GUD+15V0zNhx9D7lcI+1uxhfcD7jWbJEqsCQBrE/SG6e7nvfX9H3O0BEN10wNfq +cUeuPshybNvuv3bMZYqxf5AZAjiXPpmjuYHo1V8191Lid3jeTN2wkGdWhkECQQCI +Rj3oV3z+Hl1M1bc27GBT/MQxkEE0qiXpy780+kJ6dHsifdNv3z4+X5EA656e5zB2 +Gy/A697BRnwlxXpz9OJBAkAUe7Ap0yU8aO6g5g+gsH+18bF0MftWh81VLOo09rRp +SOHxNGGJLE5As5XkCGUZVIass1r8Q4N22Wip0QzeSWDi +- +- . * .. . * * +- * * @()Ooc()* o . +- (Q@*0CG*O() ___ +- |\_________/|/ _ \ +- | | | | | / | | +- | | | | | | | | +- | | | | | | | | +- | | | | | | | | +- | | | | | | | | +- | | | | | \_| | +- | | | | |\___/ +- |\_|__|__|_/| +- \_________/ +- +-----END RSA PRIVATE KEY----- -- 2.34.1