secureswitools/swianalysistoolkit/source/chainvalidityandinstallfilestatustools/common/dumpchainvaliditytool.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2005-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 
       
    18 
       
    19 /**
       
    20  @file 
       
    21  @internalComponent 
       
    22 */
       
    23 
       
    24 #ifndef __DUMPCHAINVALIDITYTOOL_H__
       
    25 #define __DUMPCHAINVALIDITYTOOL_H__
       
    26 #pragma warning(disable: 4786)
       
    27 
       
    28 #include "options.h"
       
    29 #include "swicertstore.h"
       
    30 #include "osinterface.h"
       
    31 #include <openssl/pem.h>
       
    32 #include <openssl/err.h>
       
    33 #include <openssl/ssl.h>
       
    34 #include <openssl/sha.h>
       
    35 #include <openssl/x509v3.h>
       
    36 #include <openssl/pkcs12.h>
       
    37 #include <fstream>
       
    38 
       
    39 const std::string CCIFile = "swicertstore.cci";
       
    40 const std::string SignSISInputParameter = "signsis.exe -p ";
       
    41 const std::string DumpSwiCertstoreInputParameter = "dumpswicertstoretool.exe -y ";
       
    42 
       
    43 const int KLength = 256 ;
       
    44 
       
    45 class SWICertStore;
       
    46 class SISCertificateChain;
       
    47 
       
    48 class DumpChainValidityTool
       
    49 {
       
    50 public:
       
    51 
       
    52 	DumpChainValidityTool();
       
    53 
       
    54 	~DumpChainValidityTool();
       
    55 
       
    56 	/**Creates SWICertstore and SISCertificateChain objects and calls the function which executes
       
    57 	   the supporting executables (SignSIS.exe and DumpSWICertstoreTool.exe).
       
    58 	  */
       
    59 	void Run(const Options& aOptions);
       
    60 
       
    61 	/**Returns the unified list of capabilities granted by all the validated chains.
       
    62 	   This is used by DumpInstallFileStatusTool.
       
    63 	  */
       
    64 	int GetUnifiedCaps() const {return iUnifiedCaps;}
       
    65 
       
    66 private:
       
    67 
       
    68 	/**Calls the ExecuteProcess() of the LaunchProcess Class ,which spawns a child process to execute
       
    69 	   signsis.exe from which certificate chains are obtained(1 pem file per chain) and DumpSWICertstoretool.exe
       
    70 	   from which certificate and capabilities information of the dat file are obtained which is then written
       
    71 	   to a file(swicertstore.cci)
       
    72 	   @param	aDirectory	Is populated with the directory name "Chain" containing all the 
       
    73 							certificate chain (1 pem file per chain).
       
    74 	  */
       
    75 	void ExecuteSupportingExe(const Options& aOptions , std::string& aDirectory);
       
    76 
       
    77 	/**Deletes the Chain directory along with the files it holds once the tool is executed.
       
    78 	   @param	aDirectory	The chain directory to be deleted.
       
    79 	  */
       
    80 	void RemoveFiles(std::string& aDirectory);
       
    81 
       
    82 private:
       
    83 	
       
    84 	int iUnifiedCaps;
       
    85 	SWICertStore* iStore;
       
    86 	SISCertificateChain* iChain;
       
    87 };
       
    88 #endif