Skip to content

Commit

Permalink
Test vectors from rfc9579
Browse files Browse the repository at this point in the history
  • Loading branch information
beldmit committed Jun 6, 2024
1 parent f179fde commit 67ad0dc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/recipes/80-test_pkcs12.t
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if (eval { require Win32::API; 1; }) {
}
$ENV{OPENSSL_WIN32_UTF8}=1;

plan tests => 31;
plan tests => 34;

# Test different PKCS#12 formats
ok(run(test(["pkcs12_format_test"])), "test pkcs12 formats");
Expand Down Expand Up @@ -170,6 +170,26 @@ ok(grep(/Trusted key usage (Oracle)/, @pkcs12info) == 0,
ok(scalar @match > 0 ? 0 : 1, "test_export_pkcs12_outerr6_empty");
}

# Test pbmac1 pkcs12 good files
for my $file ("pbmac1_256_256.good.p12", "pbmac1_512_256.good.p12", "pbmac1_512_512.good.p12")
{
my $path = srctop_file("test", "recipes", "80-test_pkcs12_data", $file);
ok(run(app(["openssl", "pkcs12", "-in", $path, "-password", "pass:1234", "-noenc"])),
"test pbmac1 pkcs12 file $file");
}

# Test pbmac1 pkcs12 bad files
for my $file ("pbmac1_256_256.bad-iter.p12", "pbmac1_256_256.bad-salt.p12", "pbmac1_256_256.no-len.p12")
{
my $path = srctop_file("test", "recipes", "80-test_pkcs12_data", $file);
with({ exit_checker => sub { return shift == 1; } },
sub {
ok(run(app(["openssl", "pkcs12", "-in", $path, "-password", "pass:1234", "-noenc"])),
"test pbmac1 pkcs12 bad file $file");
}
);
}

# Test some bad pkcs12 files
my $bad1 = srctop_file("test", "recipes", "80-test_pkcs12_data", "bad1.p12");
my $bad2 = srctop_file("test", "recipes", "80-test_pkcs12_data", "bad2.p12");
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 67ad0dc

Please sign in to comment.