xmlsecurityengine/xmlseccertman/inc/xmlsecmsymbiancertchain.h
changeset 0 e35f40988205
child 13 5474adb59cd1
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 /*
       
     2 * Copyright (c) 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 "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: An XmlSec interface to the Symbian PKIXCertChain.       
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __XMLSECCERTMAN_SYMBIANCERTCHAIN_H__
       
    19 #define __XMLSECCERTMAN_SYMBIANCERTCHAIN_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include  <e32base.h>
       
    23 #include  <pkixcertchain.h>
       
    24 
       
    25 class CSymbianCertChain : public CActive
       
    26     {
       
    27 public:  // Constructors and destructor
       
    28         
       
    29     /**
       
    30      * Create new object.
       
    31      *
       
    32      * @since S60 v3.2
       
    33      * @return pointer to new object
       
    34      */
       
    35     IMPORT_C static CSymbianCertChain* NewL();
       
    36         
       
    37     /**
       
    38      * Destructor.
       
    39      */
       
    40     IMPORT_C virtual ~CSymbianCertChain();
       
    41 
       
    42     /**
       
    43      * Create the PKIXCertChain iCertChain
       
    44      *
       
    45      * @since S60 v3.2
       
    46      * @param aEncodedCerts One or more concatenated DER encoded X.509 certificates in TUint8 format
       
    47      * @param aEncodedCertsLen Length of the DER encoded X.509 certificates
       
    48      * @param aRootCerts An array of certificates which the chain will treat as candidate root certificates
       
    49      */        
       
    50     IMPORT_C void CSymbianCertChain::InitializeL(TUint8 *aEncodedCerts, 
       
    51                                             TUint aEncodedCertsLen, 
       
    52                                             const RPointerArray< CX509Certificate > &aRootCerts);
       
    53  
       
    54     /**
       
    55      * Call ValidateL() of the iCertChain
       
    56      * @since S60 v3.2 
       
    57      */         
       
    58     IMPORT_C void CSymbianCertChain::ValidateL();
       
    59  		
       
    60     /**
       
    61      * Get the validation result
       
    62      *
       
    63      * @since S60 v3.2
       
    64      * @return EValidatedOK (0) if validation succeeds
       
    65      * @return -1 if no result can be fetched
       
    66      * @return enum TValidationError if validation fails
       
    67      */     		
       
    68     IMPORT_C TInt CSymbianCertChain::GetValidateResult();
       
    69     
       
    70     /**
       
    71      * Get the error flag
       
    72      *
       
    73      * @since S60 v3.2
       
    74      * @return error code
       
    75      */    		
       
    76     IMPORT_C TInt CSymbianCertChain::GetError();
       
    77         
       
    78 protected:
       
    79     /**
       
    80      * From CActive Callback function, invoked to handle responses from the server
       
    81      */
       
    82     void RunL();
       
    83     
       
    84     /**
       
    85      * This function is called as part of the active object's Cancel().
       
    86      */      
       
    87     void DoCancel();        
       
    88    
       
    89     /**
       
    90      * Handles Leaves from RunL function.
       
    91      */    
       
    92     TInt RunError(TInt aError);
       
    93 
       
    94 private:
       
    95     /**
       
    96     * C++ default constructor.
       
    97     */
       
    98     CSymbianCertChain();
       
    99 
       
   100     /**
       
   101      * By default Symbian 2nd phase constructor is private.
       
   102      */
       
   103     void ConstructL();
       
   104 
       
   105 private:
       
   106     /** 
       
   107      * State of active object. 
       
   108      * EUnitialized before validation
       
   109      * EValidate after validation
       
   110      */ 	
       
   111     enum TState
       
   112         {
       
   113         EUnitialized,
       
   114         EValidate
       
   115         };
       
   116 		
       
   117     /**
       
   118      * A reference to the cert chain
       
   119      */
       
   120     CPKIXCertChain *iCertChain;
       
   121 
       
   122     /** 
       
   123      * Contain result of the validation
       
   124      */
       
   125     CPKIXValidationResult *iValidationResult;
       
   126 		
       
   127     /**
       
   128      * An internal state
       
   129      */
       
   130     TState iState;        
       
   131         
       
   132     /**
       
   133      * A reference to the File Server Client
       
   134      */
       
   135     RFs iFs;
       
   136     
       
   137     /**
       
   138      * Error flag 
       
   139      */		
       
   140     TInt iError;
       
   141     };
       
   142 
       
   143 #endif      // __XMLSECCERTMAN_SYMBIANCERTCHAIN_H__