boottimeintegritycheck/inc/IntegrityCheck.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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 "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:  Header file for integrity check program.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef INTEGRITYCHECK_H
       
    20 #define INTEGRITYCHECK_H
       
    21 
       
    22 // INCLUDES 
       
    23 #include    <e32base.h>
       
    24 #include    <s32std.h>          // TStreamId
       
    25 #include    <cctcertinfo.h>     // TCertLabel
       
    26 #include    <securitydefs.h>    // TKeyIdentifier
       
    27 
       
    28 // CONSTANTS 
       
    29 
       
    30 // MACROS 
       
    31 
       
    32 // Enable C:\sys\bin binaries check.
       
    33 //#define __BTIC_BINARIES_CHECK_ENABLED
       
    34 
       
    35 // Enable sis controller verify.
       
    36 #define __BTIC_VERIFY_CONTROLLER 
       
    37 
       
    38 // DATA TYPES 
       
    39 
       
    40 // FUNCTION PROTOTYPES 
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 
       
    44 class CCTCertInfo; // TCapabilitySet
       
    45 
       
    46 // LOCAL FUNCTION PROTOTYPES 
       
    47 
       
    48 // CLASS DECLARATION 
       
    49 
       
    50 /**
       
    51 * Class CRootCertificateEntry
       
    52 *
       
    53 * Class for reading root certificates from certificate store file. 
       
    54 */
       
    55 NONSHARABLE_CLASS( CRootCertificateEntry ) : public CBase
       
    56     {
       
    57     public:
       
    58         
       
    59         /**
       
    60          * Symbian constructor
       
    61          *
       
    62          * @since 
       
    63          * @param aStream Certificate stream           
       
    64          */
       
    65         static CRootCertificateEntry* NewLC( RReadStream& aStream );
       
    66         
       
    67         /**
       
    68          * Destructor
       
    69          *
       
    70          * @since                   
       
    71          */        
       
    72         virtual ~CRootCertificateEntry();
       
    73 
       
    74         /**
       
    75          * Returns certificates data stream. This is actual 
       
    76          * x509 certificate.
       
    77          *
       
    78          * @since        
       
    79          * @return TStreamId         
       
    80          */                
       
    81         TStreamId DataStreamId() const;
       
    82         
       
    83         /**
       
    84          * Returns certificates capability set.
       
    85          *
       
    86          * @since 
       
    87          * @return TCapabilitySet        
       
    88          */        
       
    89         const TCapabilitySet& Capabilities() const;               
       
    90 
       
    91         /**
       
    92          * Returns certificate's size. This is actual size of
       
    93          * x509 certificate.
       
    94          *
       
    95          * @since 
       
    96          * @return TInt Size of certificate in bytes.        
       
    97          */        
       
    98         TInt Size() const;
       
    99 
       
   100         /**
       
   101          * Returns certificate's store ID number.
       
   102          *
       
   103          * @since 
       
   104          * @return TInt Store ID number.         
       
   105          */        
       
   106         TInt CertID() const;
       
   107         
       
   108     private:
       
   109 
       
   110         /**
       
   111          * C++ default constructor. 
       
   112          *
       
   113          * @since         
       
   114          */            
       
   115         CRootCertificateEntry();
       
   116  
       
   117          /**
       
   118          * Reads data from stream.
       
   119          *
       
   120          * @since 
       
   121          * @param aStream Certificate stream         
       
   122          */               
       
   123         void InternalizeL( RReadStream& aStream );
       
   124 
       
   125     private:
       
   126     
       
   127         TUint8          iX509CertificateType; // Defines type eg. X509
       
   128         TInt            iSize;         // Size of certificate data  
       
   129         TCertLabel      iLabel; 
       
   130         TInt            iCertId;       // Certificate's store id
       
   131         TUint8          iCACertificateType;
       
   132         TKeyIdentifier  iSubjectKeyId;
       
   133         TKeyIdentifier  iIssuerKeyId;
       
   134         RArray<TUid>    iApplications;
       
   135         TBool           iTrusted;      // Certs are always trusted
       
   136         TStreamId       iDataStreamId; // Certificate data stream
       
   137         TCapabilitySet  iCapabilities; // Certificates capability set
       
   138         TBool           iMandatory;         
       
   139     };
       
   140 
       
   141 
       
   142 /**
       
   143 * Class 
       
   144 *
       
   145 * Class for . 
       
   146 */
       
   147 NONSHARABLE_CLASS( CActiveFileObserver ) : public CActive
       
   148     {
       
   149     public:
       
   150 
       
   151         /**
       
   152         * Destructor.
       
   153         */
       
   154         virtual ~CActiveFileObserver();
       
   155 
       
   156         /**
       
   157         * Two-phased constructor.       
       
   158         */    
       
   159         static CActiveFileObserver* NewL(    
       
   160             RFs&  aFs,
       
   161             const TDesC& aPath,
       
   162             TInt& aResult );
       
   163 
       
   164         /**
       
   165         * Function íssues request to 
       
   166         */        
       
   167         void IssueRequest();
       
   168 
       
   169     protected:
       
   170 
       
   171         /**
       
   172         * Function                
       
   173         */
       
   174         void RunL();
       
   175 
       
   176         /**
       
   177         * Cancel request.
       
   178         */
       
   179         void DoCancel();  
       
   180         
       
   181         /**
       
   182         * Handles a leave occurring in the request completion 
       
   183         * event handler RunL.
       
   184         */             
       
   185         TInt RunError( TInt aError );         
       
   186 
       
   187     private:
       
   188 
       
   189         /**
       
   190         * C++ default constructor.
       
   191         */
       
   192         CActiveFileObserver( RFs&  aFs, TInt& aResult );
       
   193 
       
   194         /**
       
   195         * 2nd phase constructor.         
       
   196         */        
       
   197         void ConstructL( const TDesC& aPath );
       
   198 
       
   199     private:
       
   200                        
       
   201         RFs&    iFs;
       
   202         TInt&   iResult; 
       
   203         TInt    iRunCount;   
       
   204         RTimer  iRTimer;    
       
   205         HBufC*  iPath;                                                                                  
       
   206     };
       
   207 
       
   208 
       
   209 #endif //INTEGRITYCHECK_H
       
   210 
       
   211 //EOF