diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-03-14 13:21:48 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-03-14 13:21:48 +0000 |
commit | b820455c6e0aa38e7bdf121ec971f72e0eb097d0 (patch) | |
tree | 0f10ad6bfc453e02a18feeb398d99f0aff256433 /test | |
parent | 5c4436c97759a98794cd84dc37c937fa637aad61 (diff) |
Encrypted Data type processing. Add options to cms utility and run section 7
tests in RFC4134.
Diffstat (limited to 'test')
-rw-r--r-- | test/runex.pl | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/test/runex.pl b/test/runex.pl index 1c7431b865..ff21f90702 100644 --- a/test/runex.pl +++ b/test/runex.pl @@ -77,10 +77,12 @@ my @test_list = ( ["5.1.bin" => "encode"], ["5.2.bin" => "encode"], ["6.0.bin" => "encode, digest, cont"], -["7.1.bin" => "encode"], -["7.2.bin" => "encode"] +["7.1.bin" => "encode, encrypted, cont"], +["7.2.bin" => "encode, encrypted, cont"] ); +my $secretkey = "73:7c:79:1f:25:ea:d0:e0:46:29:25:43:52:f7:dc:62:91:e5:cb:26:91:7a:da:32"; + if (!-d $exdir) { print STDERR "FATAL ERROR: examples directory missing!!\n"; @@ -111,6 +113,10 @@ foreach (@test_list) { { run_digest_test($exdir, $tlist, $file); } + if ($tlist =~ /encrypted/) + { + run_encrypted_test($exdir, $tlist, $file, $secretkey); + } } @@ -234,6 +240,32 @@ sub run_digest_test } } +sub run_encrypted_test + { + my ($cmsdir, $tlist, $tfile, $key) = @_; + unlink "tmp.txt"; + + system ("$cmscmd -EncrypedData_decrypt -inform DER" . + " -secretkey $key" . + " -in $cmsdir/$tfile -out tmp.txt"); + + if ($?) + { + print "\tEncrypted Data command FAILED!!\n"; + $badtest++; + } + elsif ($tlist =~ /cont/ && + !cmp_files("$cmsdir/ExContent.bin", "tmp.txt")) + { + print "\tEncrypted Data content compare FAILED!!\n"; + $badtest++; + } + else + { + print "\tEncryptedData verify passed\n" if $verbose; + } + } + sub cmp_files { my ($f1, $f2) = @_; |