提交 f5cbf8fb 编写于 作者: D Dr. Stephen Henson

Fixes for S/MIME consistency checker and flexibility enhancements.

上级 7d7e640e
...@@ -53,11 +53,25 @@ ...@@ -53,11 +53,25 @@
# CMS, PKCS7 consistency test script. Run extensive tests on # CMS, PKCS7 consistency test script. Run extensive tests on
# OpenSSL PKCS#7 and CMS implementations. # OpenSSL PKCS#7 and CMS implementations.
my $ossl_path;
my $ossl_path = "../apps/openssl"; if ( -f "../apps/openssl" ) {
my $cmd = "$ossl_path cms "; $ossl_path = "../util/shlib_wrap.sh ../apps/openssl";
my $cmd2 = "$ossl_path smime "; }
elsif ( -f "..\\out32dll\\openssl.exe" ) {
$ossl_path = "..\\out32dll\\openssl.exe";
}
elsif ( -f "..\\out32\\openssl.exe" ) {
$ossl_path = "..\\out32\\openssl.exe";
}
else {
die "Can't find OpenSSL executable";
}
my $pk7cmd = "$ossl_path smime ";
my $cmscmd = "$ossl_path cms ";
my $smdir = "smime-certs"; my $smdir = "smime-certs";
my $halt_err = 1;
my $badcmd = 0; my $badcmd = 0;
...@@ -73,7 +87,6 @@ my @smime_pkcs7_tests = ( ...@@ -73,7 +87,6 @@ my @smime_pkcs7_tests = (
[ [
"signed detached content DER format, RSA key", "signed detached content DER format, RSA key",
"-sign -in smcont.txt -outform DER" "-sign -in smcont.txt -outform DER"
. " -signer $smdir/smrsa1.pem -out test.cms", . " -signer $smdir/smrsa1.pem -out test.cms",
"-verify -in test.cms -inform DER " "-verify -in test.cms -inform DER "
...@@ -98,7 +111,6 @@ my @smime_pkcs7_tests = ( ...@@ -98,7 +111,6 @@ my @smime_pkcs7_tests = (
[ [
"signed detached content DER format, DSA key", "signed detached content DER format, DSA key",
"-sign -in smcont.txt -outform DER" "-sign -in smcont.txt -outform DER"
. " -signer $smdir/smdsa1.pem -out test.cms", . " -signer $smdir/smdsa1.pem -out test.cms",
"-verify -in test.cms -inform DER " "-verify -in test.cms -inform DER "
...@@ -107,7 +119,6 @@ my @smime_pkcs7_tests = ( ...@@ -107,7 +119,6 @@ my @smime_pkcs7_tests = (
[ [
"signed detached content DER format, add RSA signer", "signed detached content DER format, add RSA signer",
"-resign -inform DER -in test.cms -outform DER" "-resign -inform DER -in test.cms -outform DER"
. " -signer $smdir/smrsa1.pem -out test2.cms", . " -signer $smdir/smrsa1.pem -out test2.cms",
"-verify -in test2.cms -inform DER " "-verify -in test2.cms -inform DER "
...@@ -148,8 +159,7 @@ my @smime_pkcs7_tests = ( ...@@ -148,8 +159,7 @@ my @smime_pkcs7_tests = (
. " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem" . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem" . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms", . " -stream -out test.cms",
"-verify -in test.cms " "-verify -in test.cms " . " -CAfile $smdir/smroot.pem -out smtst.txt"
. " -CAfile $smdir/smroot.pem -out smtst.txt"
], ],
[ [
...@@ -158,8 +168,7 @@ my @smime_pkcs7_tests = ( ...@@ -158,8 +168,7 @@ my @smime_pkcs7_tests = (
. " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem" . " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem" . " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms", . " -stream -out test.cms",
"-verify -in test.cms " "-verify -in test.cms " . " -CAfile $smdir/smroot.pem -out smtst.txt"
. " -CAfile $smdir/smroot.pem -out smtst.txt"
], ],
[ [
...@@ -277,19 +286,19 @@ my @smime_cms_comp_tests = ( ...@@ -277,19 +286,19 @@ my @smime_cms_comp_tests = (
print "CMS => PKCS#7 compatibility tests\n"; print "CMS => PKCS#7 compatibility tests\n";
run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $cmd, $cmd2 ); run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $cmscmd, $pk7cmd );
print "CMS <= PKCS#7 compatibility tests\n"; print "CMS <= PKCS#7 compatibility tests\n";
run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $cmd2, $cmd ); run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $pk7cmd, $cmscmd );
print "CMS <=> CMS consistency tests\n"; print "CMS <=> CMS consistency tests\n";
run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $cmd, $cmd ); run_smime_tests( \$badcmd, \@smime_pkcs7_tests, $cmscmd, $cmscmd );
run_smime_tests( \$badcmd, \@smime_cms_tests, $cmd, $cmd ); run_smime_tests( \$badcmd, \@smime_cms_tests, $cmscmd, $cmscmd );
if ( `$ossl_path version -f` =~ /ZLIB/ ) { if ( `$ossl_path version -f` =~ /ZLIB/ ) {
run_smime_tests( \$badcmd, \@smime_cms_comp_tests, $cmd, $cmd ); run_smime_tests( \$badcmd, \@smime_cms_comp_tests, $cmscmd, $cmscmd );
} }
else { else {
print "Zlib not supported: compression tests skipped\n"; print "Zlib not supported: compression tests skipped\n";
...@@ -311,12 +320,14 @@ sub run_smime_tests { ...@@ -311,12 +320,14 @@ sub run_smime_tests {
if ($?) { if ($?) {
print "$tnam: generation error\n"; print "$tnam: generation error\n";
$$rv++; $$rv++;
exit 1 if $halt_err;
next; next;
} }
system( $vcmd . $rvcmd ); system( $vcmd . $rvcmd );
if ($?) { if ($?) {
print "$tnam: verify error\n"; print "$tnam: verify error\n";
$$rv++; $$rv++;
exit 1 if $halt_err;
next; next;
} }
print "$tnam: OK\n"; print "$tnam: OK\n";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册