* tests.com: Add the symbol openssl_conf, so the openssl application

stops complaining about a missing configuration file.  Define the logical
  name PERL_ENV_TABLES with values to Perl considers the DCL symbol table
  as part of the environment (see 'man perlvms' for details), so cms-test.pl
  can get the value of EXE_DIR from tests.com, among others.
* cms-test.pl: Make changes to have it work on VMS as well.  Upper or mixed
  case options need to be quoted and the openssl command needs a VMS-specific
  treatment.  It all should work properly on Unix, I hope it does on Windows
  as well...
This commit is contained in:
Richard Levitte 2010-11-22 23:42:51 +00:00
parent 4cdde22432
commit 1cf7bbce48
2 changed files with 52 additions and 45 deletions

View file

@ -54,9 +54,13 @@
# OpenSSL PKCS#7 and CMS implementations.
my $ossl_path;
my $redir = " 2>cms.err 1>cms.out";
my $redir = " 2> cms.err > cms.out";
# Make VMS work
if ( $^O eq "VMS" && -f "$ENV{EXE_DIR}openssl.exe" ) {
$ossl_path = "pipe mcr $ENV{EXE_DIR}openssl.exe";
}
# Make MSYS work
if ( $^O eq "MSWin32" && -f "../apps/openssl.exe" ) {
elsif ( $^O eq "MSWin32" && -f "../apps/openssl.exe" ) {
$ossl_path = "cmd /c ..\\apps\\openssl";
}
elsif ( -f "../apps/openssl$ENV{EXE_EXT}" ) {
@ -84,79 +88,79 @@ my @smime_pkcs7_tests = (
[
"signed content DER format, RSA key",
"-sign -in smcont.txt -outform DER -nodetach"
"-sign -in smcont.txt -outform \"DER\" -nodetach"
. " -certfile $smdir/smroot.pem"
. " -signer $smdir/smrsa1.pem -out test.cms",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
"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",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt -content smcont.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt -content smcont.txt"
],
[
"signed content test streaming BER format, RSA",
"-sign -in smcont.txt -outform DER -nodetach"
"-sign -in smcont.txt -outform \"DER\" -nodetach"
. " -stream -signer $smdir/smrsa1.pem -out test.cms",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
"signed content DER format, DSA key",
"-sign -in smcont.txt -outform DER -nodetach"
"-sign -in smcont.txt -outform \"DER\" -nodetach"
. " -signer $smdir/smdsa1.pem -out test.cms",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
"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",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt -content smcont.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt -content smcont.txt"
],
[
"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",
"-verify -in test2.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt -content smcont.txt"
"-verify -in test2.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt -content smcont.txt"
],
[
"signed content test streaming BER format, DSA key",
"-sign -in smcont.txt -outform DER -nodetach"
"-sign -in smcont.txt -outform \"DER\" -nodetach"
. " -stream -signer $smdir/smdsa1.pem -out test.cms",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
"signed content test streaming BER format, 2 DSA and 2 RSA keys",
"-sign -in smcont.txt -outform DER -nodetach"
"-sign -in smcont.txt -outform \"DER\" -nodetach"
. " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
"signed content test streaming BER format, 2 DSA and 2 RSA keys, no attributes",
"-sign -in smcont.txt -outform DER -noattr -nodetach"
"-sign -in smcont.txt -outform \"DER\" -noattr -nodetach"
. " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
@ -165,7 +169,7 @@ my @smime_pkcs7_tests = (
. " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms",
"-verify -in test.cms " . " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms " . " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
@ -174,7 +178,7 @@ my @smime_pkcs7_tests = (
. " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms",
"-verify -in test.cms " . " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms " . " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
@ -215,12 +219,12 @@ my @smime_cms_tests = (
[
"signed content test streaming BER format, 2 DSA and 2 RSA keys, keyid",
"-sign -in smcont.txt -outform DER -nodetach -keyid"
"-sign -in smcont.txt -outform \"DER\" -nodetach -keyid"
. " -signer $smdir/smrsa1.pem -signer $smdir/smrsa2.pem"
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms",
"-verify -in test.cms -inform DER "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
"-verify -in test.cms -inform \"DER\" "
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
@ -230,7 +234,7 @@ my @smime_cms_tests = (
. " -signer $smdir/smdsa1.pem -signer $smdir/smdsa2.pem"
. " -stream -out test.cms",
"-verify -in test.cms -inform PEM "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
@ -239,7 +243,7 @@ my @smime_cms_tests = (
. " -receipt_request_to test\@openssl.org -receipt_request_all"
. " -out test.cms",
"-verify -in test.cms "
. " -CAfile $smdir/smroot.pem -out smtst.txt"
. " \"-CAfile\" $smdir/smroot.pem -out smtst.txt"
],
[
@ -248,7 +252,7 @@ my @smime_cms_tests = (
. " -signer $smdir/smrsa2.pem"
. " -out test2.cms",
"-verify_receipt test2.cms -in test.cms"
. " -CAfile $smdir/smroot.pem"
. " \"-CAfile\" $smdir/smroot.pem"
],
[
@ -289,38 +293,38 @@ my @smime_cms_tests = (
[
"encrypted content test streaming PEM format, 128 bit RC2 key",
"-EncryptedData_encrypt -in smcont.txt -outform PEM"
"\"-EncryptedData_encrypt\" -in smcont.txt -outform PEM"
. " -rc2 -secretkey 000102030405060708090A0B0C0D0E0F"
. " -stream -out test.cms",
"-EncryptedData_decrypt -in test.cms -inform PEM "
"\"-EncryptedData_decrypt\" -in test.cms -inform PEM "
. " -secretkey 000102030405060708090A0B0C0D0E0F -out smtst.txt"
],
[
"encrypted content test streaming PEM format, 40 bit RC2 key",
"-EncryptedData_encrypt -in smcont.txt -outform PEM"
"\"-EncryptedData_encrypt\" -in smcont.txt -outform PEM"
. " -rc2 -secretkey 0001020304"
. " -stream -out test.cms",
"-EncryptedData_decrypt -in test.cms -inform PEM "
"\"-EncryptedData_decrypt\" -in test.cms -inform PEM "
. " -secretkey 0001020304 -out smtst.txt"
],
[
"encrypted content test streaming PEM format, triple DES key",
"-EncryptedData_encrypt -in smcont.txt -outform PEM"
"\"-EncryptedData_encrypt\" -in smcont.txt -outform PEM"
. " -des3 -secretkey 000102030405060708090A0B0C0D0E0F1011121314151617"
. " -stream -out test.cms",
"-EncryptedData_decrypt -in test.cms -inform PEM "
"\"-EncryptedData_decrypt\" -in test.cms -inform PEM "
. " -secretkey 000102030405060708090A0B0C0D0E0F1011121314151617"
. " -out smtst.txt"
],
[
"encrypted content test streaming PEM format, 128 bit AES key",
"-EncryptedData_encrypt -in smcont.txt -outform PEM"
"\"-EncryptedData_encrypt\" -in smcont.txt -outform PEM"
. " -aes128 -secretkey 000102030405060708090A0B0C0D0E0F"
. " -stream -out test.cms",
"-EncryptedData_decrypt -in test.cms -inform PEM "
"\"-EncryptedData_decrypt\" -in test.cms -inform PEM "
. " -secretkey 000102030405060708090A0B0C0D0E0F -out smtst.txt"
],

View file

@ -14,6 +14,7 @@ $ exe_dir := sys$disk:[-.'__arch'.exe.apps]
$
$ sslroot = f$parse("sys$disk:[-.apps];",,,,"syntax_only") - "].;"+ ".]"
$ define /translation_attributes = concealed sslroot 'sslroot'
$ openssl_conf := sslroot:[000000]openssl-vms.cnf
$
$ set default '__here'
$
@ -291,6 +292,8 @@ $ mcr 'texe_dir''jpaketest'
$ return
$ test_cms:
$ write sys$output "CMS consistency test"
$ ! The following makes perl include the DCL symbol table in the env.
$ define/user perl_env_tables clisym_local,lnm$file_dev,ctrl_env
$ perl CMS-TEST.PL
$ return
$