e32tools/e32lib/seclib/secdump.cpp
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32tools/seclib/secdump.cpp
       
    15 // Exercise seclib
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "h_utl.h"
       
    20 #include "h_ver.h"
       
    21 
       
    22 #include <e32def.h>
       
    23 #include <seclib.h>
       
    24 
       
    25 #include <stdio.h>
       
    26 
       
    27 int main(int argc, char *argv[])
       
    28 	{
       
    29 	Print(EAlways,"secdump");
       
    30   	Print(EAlways," V%02d.%02d (Build %03d)\n",MajorVersion,MinorVersion,Build);
       
    31   	Print(EAlways,Copyright);
       
    32 
       
    33 	if (argc < 1  || !argv[1])
       
    34 		{
       
    35 		Print(EAlways, "Usage: %s filename\n\n", argv[0]);
       
    36 		Print(EAlways, "Dumps the capabilites in the file filename\n\n");
       
    37 		return KErrNotFound;
       
    38 		}
       
    39 
       
    40 	SBinarySecurityInfo info;
       
    41 
       
    42 	TInt err = GetSecurityInfo(argv[1], info);
       
    43 
       
    44 	if (!err)
       
    45 		{
       
    46 		for (TInt count = 0; count < KCapabilitySetMaxSize; ++count)
       
    47 			{
       
    48 			Print(EAlways, "Byte #%d\t0x%02x\n", count, info.iCapabilities[count]);
       
    49 			}
       
    50 
       
    51 		Print(EAlways, "Secure ID:\t0x%08x.\n", info.iSecureId);
       
    52 
       
    53 		Print(EAlways, "Vendor ID:\t0x%08x.\n", info.iVendorId);
       
    54 
       
    55 		Print(EAlways, "Input file is%s an E32Image file.\n", (info.iE32Image ? "" : " not"));
       
    56 		}
       
    57 	else
       
    58 		{
       
    59 		Print(EAlways, "ERROR: %s failed with %d.\n", argv[0], err);
       
    60 		}
       
    61 
       
    62 	return err;
       
    63 	}