toolsandutils/e32tools/seclib/secdump.cpp
changeset 0 83f4b4db085c
child 2 99082257a271
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     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 the License "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 <e32def_private.h>
       
    24 #include "seclib.h"
       
    25 
       
    26 #include <stdio.h>
       
    27 
       
    28 int main(int argc, char *argv[])
       
    29 	{
       
    30 	Print(EAlways,"secdump");
       
    31   	Print(EAlways," V%02d.%02d (Build %03d)\n",MajorVersion,MinorVersion,Build);
       
    32   	Print(EAlways,Copyright);
       
    33 
       
    34 	if (argc < 1  || !argv[1])
       
    35 		{
       
    36 		Print(EAlways, "Usage: %s filename\n\n", argv[0]);
       
    37 		Print(EAlways, "Dumps the capabilites in the file filename\n\n");
       
    38 		return KErrNotFound;
       
    39 		}
       
    40 
       
    41 	SBinarySecurityInfo info;
       
    42 
       
    43 	TInt err = GetSecurityInfo(argv[1], info);
       
    44 
       
    45 	if (!err)
       
    46 		{
       
    47 		for (TInt count = 0; count < KCapabilitySetMaxSize; ++count)
       
    48 			{
       
    49 			Print(EAlways, "Byte #%d\t0x%02x\n", count, info.iCapabilities[count]);
       
    50 			}
       
    51 
       
    52 		Print(EAlways, "Secure ID:\t0x%08x.\n", info.iSecureId);
       
    53 
       
    54 		Print(EAlways, "Vendor ID:\t0x%08x.\n", info.iVendorId);
       
    55 
       
    56 		Print(EAlways, "Input file is%s an E32Image file.\n", (info.iE32Image ? "" : " not"));
       
    57 		}
       
    58 	else
       
    59 		{
       
    60 		Print(EAlways, "ERROR: %s failed with %d.\n", argv[0], err);
       
    61 		}
       
    62 
       
    63 	return err;
       
    64 	}