wim/WimServer/inc/WimSignTextHandler.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003 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:  WIM Sign Text Handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CWIMSIGNTEXTHANDLER_H
       
    21 #define CWIMSIGNTEXTHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <secdlg.h>
       
    25 #include "WimResponse.h"
       
    26 #include "WimUtilityFuncs.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CWimUtilityFuncs;
       
    30 class CWimSecurityDlgHandler;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  WIM Sign Text Handler.
       
    36 *  Handles Sign Text operations. 
       
    37 *
       
    38 *  @since Series60 2.6
       
    39 */
       
    40 class CWimSignTextHandler : public CActive
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43         
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         */
       
    47         static CWimSignTextHandler* NewL();
       
    48         
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CWimSignTextHandler();
       
    53 
       
    54     public: // New functions
       
    55         
       
    56         /**
       
    57         * Start the SignText operation.
       
    58         * @param aMessage Encapsulates a client request.
       
    59         * @return void 
       
    60         */
       
    61         void SignTextL( const RMessage2& aMessage );
       
    62       
       
    63     private:
       
    64 
       
    65         /**
       
    66         * C++ default constructor.
       
    67         */
       
    68         CWimSignTextHandler();
       
    69 
       
    70         /**
       
    71         * By default Symbian 2nd phase constructor is private.
       
    72         */
       
    73         void ConstructL();
       
    74 
       
    75         /**
       
    76         * Continues signing operation after signing PIN has asked from user.
       
    77         * Calls WIMI_SignReq() method which take care of actual sign operation.
       
    78         * Response (signed text) to call is handled in CWimCallBack::SignResp().
       
    79         * @return void 
       
    80         */
       
    81         void ContinueSigningL();
       
    82 
       
    83         /**
       
    84         * Ask PIN from user. Shows PIN query dialog.
       
    85         * @return void 
       
    86         */
       
    87         void AskPin();
       
    88 
       
    89         /**
       
    90         * Get parameters for PIN. iKeyReferense has to be set before
       
    91         * this function is used.
       
    92         * @param aPinParams PIN parameters that has to be set
       
    93         * @return void 
       
    94         */
       
    95         void GetPinParamsL( TPINParams& aPinParams ) const;
       
    96 
       
    97         /**
       
    98         * Clean member data
       
    99         * @return void 
       
   100         */
       
   101         void CleanUp();
       
   102 
       
   103         /**
       
   104         * From CActive. RunL: Handles signing operation as state machine.
       
   105         */
       
   106         void RunL();
       
   107 
       
   108         /**
       
   109         * From CActive. DoCancel: Asyncronous request cancelled
       
   110         */
       
   111         void DoCancel();
       
   112 
       
   113         /**
       
   114         * From CActive. The active scheduler calls this function if this active
       
   115         * object's RunL() function leaves.
       
   116         * Handles necessary cleanup and completes request with
       
   117         * received error code.
       
   118         * @param aError Leave code
       
   119         * @return Error code to Active Scheduler, is always zero.
       
   120         */ 
       
   121         TInt RunError( TInt aError );
       
   122 
       
   123     private:    // Data
       
   124 
       
   125         // Enumerator for ongoing sign text state
       
   126         enum TSignTextState
       
   127             {
       
   128             EAskPin,
       
   129             ECallbackResponse,
       
   130             EShowPinBlocked,
       
   131             EShowCardIsRemoved,
       
   132             EWimiError,
       
   133             ESigningDone
       
   134             };
       
   135 
       
   136         // Pointer to utility function class. Owned.
       
   137         CWimUtilityFuncs*       iWimUtilFuncs;
       
   138         // Pointer to security handler class. Owned.
       
   139         CWimSecurityDlgHandler* iWimSecDlg;
       
   140         // PIN for signing
       
   141         TPINValue               iSigningPin;
       
   142         // Pointer to WimResponse for completing the client request. 
       
   143         // Deleted here or in callback function.
       
   144         CWimResponse*           iResponseID;
       
   145         // Transaction ID. This is deleted in CWimCallBack::SignResp() 
       
   146         // or here in case of WIMI error.
       
   147         TWimReqTrId*            iTrId;
       
   148         // Key reference. Owned.
       
   149         TAny*                   iKeyReference;
       
   150         // State of signing operation
       
   151         TSignTextState          iSigningState;
       
   152         // Buffer for data to be signed. Owned.
       
   153         HBufC8*                 iSigningDataBuf;
       
   154         // Pointer to data to be signer. Owned.
       
   155         TPtr8*                  iSigningDataPtr;
       
   156         // Flag to tell if PIN query is retry or not
       
   157         TBool                   iRetry;
       
   158         // PIN parameters
       
   159         TPINParams              iPinParams;
       
   160                 
       
   161     };
       
   162 
       
   163 #endif      // CWIMSIGNTEXTHANDLER_H  
       
   164             
       
   165 // End of File