Add AGL's "beer mug" PEM file as another test input
authorBenjamin Kaduk <bkaduk@akamai.com>
Thu, 23 Feb 2017 22:22:10 +0000 (16:22 -0600)
committerRichard Levitte <levitte@openssl.org>
Tue, 28 Feb 2017 20:25:08 +0000 (21:25 +0100)
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 <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2756)
(cherry picked from commit a00b9560f7ece1e51bd7a8dc6a7ffb7a3d20cf86)

test/recipes/04-test_pem.t
test/recipes/04-test_pem_data/beermug.pem [new file with mode: 0644]

index 291f2ba3da5047a005166c89bfdf37536cabe640..23d1ef8a93ea5357f25732978cf111fb2b90aa76 100644 (file)
@@ -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 (file)
index 0000000..98b04b7
--- /dev/null
@@ -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-----