os/security/crypto/weakcryptospi/test/tcryptospi/testdata/hashhmac/hashgensha2.pl
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 #
     2 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 # All rights reserved.
     4 # This component and the accompanying materials are made available
     5 # under the terms of the License "Eclipse Public License v1.0"
     6 # which accompanies this distribution, and is available
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 #
     9 # Initial Contributors:
    10 # Nokia Corporation - initial contribution.
    11 #
    12 # Contributors:
    13 #
    14 # Description: 
    15 #
    16 
    17 my $numArgs = $#ARGV + 1;
    18 
    19 my $file = @ARGV[0];
    20 my $origkey = @ARGV[1];
    21 my $key = $origkey;
    22 print "key is: $origkey\n";
    23 print "File is: $file\n";
    24 
    25 
    26 my $outfile = $file;
    27 substr($outfile,length($file)-4,length($file),"_SHA2HASHDATA.txt");
    28 print $outfile;
    29 print "\n";
    30 
    31 open(MARKER, ">$outfile");
    32 print MARKER "****** HASH SHA224/SHA256/SHA384/SHA512 ******\n\n";
    33 close (MARKER);
    34 
    35 my $failed = system("openssl dgst -sha224 $file >> $outfile");
    36 if ($failed) { print "openssl failed because $!"};
    37 
    38 my $failed = system("openssl dgst -sha256 $file >> $outfile");
    39 if ($failed) { print " openssl failed because $!"};
    40 
    41 my $failed = system("openssl dgst -sha384 $file >> $outfile");
    42 if ($failed) { print " openssl failed because $!"};
    43 
    44 my $failed = system("openssl dgst -sha512 $file >> $outfile");
    45 if ($failed) { print " openssl failed because $!"};
    46 
    47 open(MARKER, ">>$outfile");
    48 print MARKER "\n\n****** HMAC SHA224/SHA256/SHA384/SHA512 ******\n\n";
    49 close (MARKER);
    50 
    51 my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha224 $file >> $outfile");
    52 if ($failed) { print " openssl failed because $!"};
    53 
    54 my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha256 $file >> $outfile");
    55 if ($failed) { print " openssl failed because $!"};
    56 
    57 my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha384 $file >> $outfile");
    58 if ($failed) { print " openssl failed because $!"};
    59 
    60 my $failed = system("openssl dgst -hmac CryptoSpiValidKey -sha512 $file >> $outfile");
    61 if ($failed) { print " openssl failed because $!"};