setup("test_rsa");
-plan tests => 10;
+plan tests => 12;
require_ok(srctop_file('test', 'recipes', 'tconversion.pl'));
ok(run(app([ 'openssl', $cmd, '-check', '-in', srctop_file('test', 'testrsa.pem'), '-noout'])),
"$cmd -check" );
- SKIP: {
+ SKIP: {
skip "Skipping $cmd conversion test", 3
if disabled("rsa");
};
}
- SKIP: {
+ SKIP: {
skip "Skipping msblob conversion test", 1
if disabled($cmd) || $cmd eq 'pkey';
-args => ["rsa", "-pubin", "-pubout"] );
};
}
+ SKIP: {
+ skip "Skipping PVK conversion test", 1
+ if disabled($cmd) || $cmd eq 'pkey' || disabled("rc4")
+ || disabled ("legacy");
+
+ subtest "$cmd conversions -- private key" => sub {
+ tconversion( -type => 'pvk', -prefix => "$cmd-pvk",
+ -in => srctop_file("test", "testrsa.pem"),
+ -args => ["rsa", "-passin", "pass:testpass",
+ "-passout", "pass:testpass",
+ "-provider", "default",
+ "-provider", "legacy"] );
+ };
+ }
}
# specific test types as key.
"*" => [ "d", "p" ],
"msb" => [ "d", "p", "msblob" ],
+ "pvk" => [ "d", "p", "pvk" ],
);
sub tconversion {
my %opts = @_;
+ $n # initial conversions from p to all forms (A)
+ $n*$n # conversion from result of A to all forms (B)
+ 1 # comparing original test file to p form of A
- + $n*($n-1); # comparing first conversion to each fom in A with B
+ + $n*($n-1); # comparing first conversion to each form in A with B
$totaltests-- if ($testtype eq "p7d"); # no comparison of original test file
+ $totaltests -= $n if ($testtype eq "pvk"); # no comparisons of the pvk form
plan tests => $totaltests;
my @cmd = ("openssl", @openssl_args);
}
foreach my $to (@conversionforms) {
- next if $to eq "d";
+ next if $to eq "d" or $to eq "pvk";
foreach my $from (@conversionforms) {
is(cmp_text("$prefix-f.$to", "$prefix-ff.$from$to"), 0,
"comparing $to to $from$to");