os/security/crypto/weakcryptospi/test/tcryptospi/testdata/hashhmac/hashgensha2.pl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcryptospi/test/tcryptospi/testdata/hashhmac/hashgensha2.pl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,61 @@
     1.4 +#
     1.5 +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +# All rights reserved.
     1.7 +# This component and the accompanying materials are made available
     1.8 +# under the terms of the License "Eclipse Public License v1.0"
     1.9 +# which accompanies this distribution, and is available
    1.10 +# at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +#
    1.12 +# Initial Contributors:
    1.13 +# Nokia Corporation - initial contribution.
    1.14 +#
    1.15 +# Contributors:
    1.16 +#
    1.17 +# Description: 
    1.18 +#
    1.19 +
    1.20 +my $numArgs = $#ARGV + 1;
    1.21 +
    1.22 +my $file = @ARGV[0];
    1.23 +my $origkey = @ARGV[1];
    1.24 +my $key = $origkey;
    1.25 +print "key is: $origkey\n";
    1.26 +print "File is: $file\n";
    1.27 +
    1.28 +
    1.29 +my $outfile = $file;
    1.30 +substr($outfile,length($file)-4,length($file),"_SHA2HASHDATA.txt");
    1.31 +print $outfile;
    1.32 +print "\n";
    1.33 +
    1.34 +open(MARKER, ">$outfile");
    1.35 +print MARKER "****** HASH SHA224/SHA256/SHA384/SHA512 ******\n\n";
    1.36 +close (MARKER);
    1.37 +
    1.38 +my $failed = system("openssl dgst -sha224 $file >> $outfile");
    1.39 +if ($failed) { print "openssl failed because $!"};
    1.40 +
    1.41 +my $failed = system("openssl dgst -sha256 $file >> $outfile");
    1.42 +if ($failed) { print " openssl failed because $!"};
    1.43 +
    1.44 +my $failed = system("openssl dgst -sha384 $file >> $outfile");
    1.45 +if ($failed) { print " openssl failed because $!"};
    1.46 +
    1.47 +my $failed = system("openssl dgst -sha512 $file >> $outfile");
    1.48 +if ($failed) { print " openssl failed because $!"};
    1.49 +
    1.50 +open(MARKER, ">>$outfile");
    1.51 +print MARKER "\n\n****** HMAC SHA224/SHA256/SHA384/SHA512 ******\n\n";
    1.52 +close (MARKER);
    1.53 +
    1.54 +my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha224 $file >> $outfile");
    1.55 +if ($failed) { print " openssl failed because $!"};
    1.56 +
    1.57 +my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha256 $file >> $outfile");
    1.58 +if ($failed) { print " openssl failed because $!"};
    1.59 +
    1.60 +my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha384 $file >> $outfile");
    1.61 +if ($failed) { print " openssl failed because $!"};
    1.62 +
    1.63 +my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha512 $file >> $outfile");
    1.64 +if ($failed) { print " openssl failed because $!"};