pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h
changeset 0 164170e6151a
child 5 3b17fc5c9564
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2006-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:   Definition of the CCTSecurityDialogsAO class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CTSECURITYDIALOGSAO_H
       
    20 #define CTSECURITYDIALOGSAO_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "CTSecurityDialogDefs.h"
       
    24 #include <secdlgimpldefs.h>
       
    25 #include <badesca.h>
       
    26 #include <mctkeystore.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCTSecurityDialogNotifier;
       
    30 class CUnifiedCertStore;
       
    31 class CUnifiedKeyStore;
       
    32 class CCertAttributeFilter;
       
    33 class CCTCertInfo;
       
    34 class CCTKeyInfo;
       
    35 class CX509Certificate;
       
    36 class CX500DistinguishedName;
       
    37 class MCTWritableCertStore;
       
    38 class CAknQueryDialog;
       
    39 class CCTPinQueryDialog;
       
    40 
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  Active object class of CT Security Dialogs
       
    46 *  Calls from client side are handled in this class.
       
    47 *
       
    48 *  @lib CTSecDlgNotifier.dll
       
    49 *  @since Series 60 2.8
       
    50 */
       
    51 NONSHARABLE_CLASS( CCTSecurityDialogsAO ): public CActive
       
    52     {
       
    53     public:  // Constructors and destructor
       
    54 
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         */
       
    58         static CCTSecurityDialogsAO* NewL( CCTSecurityDialogNotifier* aNotifier, TBool& aDeleted );
       
    59 
       
    60         /**
       
    61         * Destructor.
       
    62         */
       
    63         virtual ~CCTSecurityDialogsAO();
       
    64 
       
    65     public: // New functions
       
    66 
       
    67         /**
       
    68         * Starts handling of the message
       
    69         * @param aBuffer  Data passed from client RNotifier::StartNotifierAndGetResponse() call
       
    70         * @param aReplySlot  Identifies which message argument to use for the reply
       
    71         * @param aMessage  Encapsulates the client request
       
    72         */
       
    73         void StartLD( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage );
       
    74 
       
    75 
       
    76         // For server authentication failure
       
    77         /**
       
    78         * Creates the message to be shown in the certificate details query.
       
    79         *
       
    80         * @return message text
       
    81         */
       
    82         HBufC* CreateMessageL();
       
    83 
       
    84     protected:  // Functions from CActive
       
    85 
       
    86         /**
       
    87         * RunL is called after modeless dialog is dismissed.
       
    88         */
       
    89         void RunL();
       
    90 
       
    91         /**
       
    92         * Does nothing.
       
    93         */
       
    94         void DoCancel();
       
    95 
       
    96         /**
       
    97         * If RunL leaves, error is handled here.
       
    98         */
       
    99         TInt RunError(TInt aError);
       
   100 
       
   101     private:
       
   102 
       
   103         enum TOperationStatus
       
   104         {
       
   105             EOperationCompleted = 0xFFF0,
       
   106             EOperationCancel,
       
   107             EOperationSignTextShown,
       
   108             EOperationInitCertStore,
       
   109             EOperationRetrieveCertInfos,
       
   110             EOperationSelectCert,
       
   111             EGetCertInfo,
       
   112             EGetCertificate,
       
   113             EInitKeyStore,
       
   114             EGetKeyInfos,
       
   115             EGetKeyInfoByHandle,
       
   116             EShowCertDialog,
       
   117             EShowCSRDialog,
       
   118             EEnterNewPIN,
       
   119             EEnterUnblockPIN,
       
   120             EVerifyNewPin,
       
   121             EVerifyPINs,
       
   122             EServerCertCheckUserResp,
       
   123             ESaveServerCert,
       
   124             EAddTrustedSite,
       
   125             ERetrieveServerCerts,
       
   126             ECheckServerCerts,
       
   127             EProcessTrustedSite,
       
   128             EUnknownError
       
   129             };
       
   130 
       
   131         /**
       
   132         * C++ default constructor.
       
   133         */
       
   134         CCTSecurityDialogsAO( CCTSecurityDialogNotifier* aNotifier, TBool& aDeleted );
       
   135 
       
   136         /**
       
   137         * By default Symbian 2nd phase constructor is private.
       
   138         */
       
   139         void ConstructL();
       
   140 
       
   141         void InitCertStoreL();
       
   142 
       
   143         void InitKeyStoreL();
       
   144 
       
   145         void GetKeyInfosL();
       
   146 
       
   147         void GetKeyInfoByHandleL();
       
   148 
       
   149         void DoHandlePinOperationL();
       
   150 
       
   151         void DoHandleUnblockPinOperationL();
       
   152 
       
   153         void DoHandleMultilinePinQueryL(const TInt& aDlgType);
       
   154 
       
   155         void DoHandleSignTextL(const TDesC8& aBuffer);
       
   156 
       
   157         void DoHandleCSRL(const TDesC8& aBuffer);
       
   158 
       
   159         void DoHandleCertDetailsL(const TDesC8& aBuffer);
       
   160 
       
   161         void DoHandleSaveCertL(const TDesC8& aBuffer);
       
   162 
       
   163         void DoHandleSaveServerCertL();
       
   164 
       
   165         void DoHandleServerAuthFailL(const TDesC8& aBuffer);
       
   166 
       
   167         void ShowCertDialogL();
       
   168 
       
   169         void ShowNoTrustDialogL();
       
   170 
       
   171         void ShowCSRDialogL();
       
   172 
       
   173         /**
       
   174         * Saves digital signature receipt
       
   175         */
       
   176         void SaveReceiptL(const TDesC8& aBuffer);
       
   177 
       
   178         void DoHandleSelectCertificateL();
       
   179 
       
   180         void DoHandleMessageL(
       
   181             const TInt& aDlgType,
       
   182             const TDesC& aDynamicText,
       
   183             const TDesC& aPinQueryHeading,
       
   184             const TInt aMinLength,
       
   185             const TInt aMaxLength);
       
   186 
       
   187         /////////////////////////////////
       
   188         // Certificate details functions
       
   189 
       
   190         HBufC* MessageQueryCertDetailsL(
       
   191             const TDesC8& aCert,
       
   192             const CCTCertInfo* aCertInfo,
       
   193             TCertificateFormat aCertFormat,
       
   194             const CCTKeyInfo* aKeyInfo);
       
   195 
       
   196         void AddSiteL( TDes& aMessage );
       
   197 
       
   198         void AddIssuerAndSubjectL(
       
   199             TDes& aMessage,
       
   200             const CX509Certificate& aCert);
       
   201 
       
   202         void AddKeyUsageL(
       
   203             TDes& aMessage,
       
   204             const CCTKeyInfo* aKeyInfo );
       
   205 
       
   206         void AddKeyUsageL(
       
   207             TDes& aMessage,
       
   208             const CX509Certificate& aCert);
       
   209 
       
   210         void AddKeyLocationL(
       
   211             TDes& aMessage,
       
   212             const CCTKeyInfo* aKeyInfo );
       
   213 
       
   214         void AddKeySizeL(
       
   215             TDes& aMessage,
       
   216             const CCTKeyInfo* aKeyInfo );
       
   217 
       
   218         void AddKeyAlgorithmL(
       
   219             TDes& aMessage,
       
   220             const CCTKeyInfo* aKeyInfo );
       
   221 
       
   222         void AddCertLocationL(
       
   223             TDes& aMessage,
       
   224             const CCTCertInfo* aCertInfo );
       
   225 
       
   226         void AddLocationInfoL(
       
   227             TDes& aMessage,
       
   228             TUid aUid,
       
   229             TBool aCertificate );
       
   230 
       
   231         void AddValidityPeriodL(
       
   232             TDes& aMessage, const CX509Certificate& aCert);
       
   233 
       
   234         void AddCertFormatL(
       
   235             TDes& aMessage, TCertificateFormat aCertFormat);
       
   236 
       
   237         void AddCertAlgorithmsL(
       
   238             TDes& aMessage, const CX509Certificate& aCert);
       
   239 
       
   240         void AddCertSerialNumberL(
       
   241             TDes& aMessage, const CX509Certificate& aCert);
       
   242 
       
   243         void AddCertFingerprintsL(
       
   244             TDes& aMessage, const CX509Certificate& aCert);
       
   245 
       
   246         void DevideToBlocks( const TDesC8& aInput, TDes& aOutput);
       
   247 
       
   248         void DetailsFieldDynamicL(
       
   249             TDes& aMessage,
       
   250             const TDesC& aValue,
       
   251             TInt aResourceOne,
       
   252             TInt aResourceTwo);
       
   253 
       
   254         void DetailsFieldResourceL(
       
   255             TDes& aMessage, TInt aResourceOne,
       
   256             TInt aResourceTwo);
       
   257 
       
   258         void DetailsResourceL(TDes& aMessage, TInt aResource);
       
   259 
       
   260         void DetailsDynamicL(
       
   261             TDes& aMessage,
       
   262             const TDesC& aValue,
       
   263             TInt aResource);
       
   264 
       
   265         void MapTlsProviderOperation( TUint aOperation );
       
   266 
       
   267         TPtrC CutCertificateField(const TDesC&  aField);
       
   268 
       
   269         /**
       
   270         * Completes client's request
       
   271         */
       
   272         void HandleResponseAndCompleteL();
       
   273 
       
   274         /**
       
   275         * Checks that are two PINs the same
       
   276         */
       
   277         void VerifyPinsL();
       
   278         
       
   279     private:    // Data
       
   280         RMessagePtr2 iMessagePtr;
       
   281         TSecurityDialogNotification iOperation;
       
   282         TBool iRetry;
       
   283         TSignInput iSignInput;
       
   284         TPINParams iPIN;
       
   285         TPINParams iUnblockPIN;
       
   286         TInt iReplySlot;
       
   287         TPINValue iPINValue1;
       
   288         TPINValue iPINValue2;
       
   289         TPINValue iPINValueVerify;
       
   290         RArray<TCTTokenObjectHandle> iCertHandleList;
       
   291         TBool iRetValue;
       
   292         TCTTokenObjectHandle iTokenHandle;
       
   293 
       
   294         TServerAuthenticationFailureInput iServerAuthenticationFailureInput;
       
   295 
       
   296         CCTSecurityDialogNotifier* iNotifier;
       
   297         TInt iNextStep;
       
   298         TInt iMultiLineDlgType;
       
   299 
       
   300         // For retrieving signText dialog
       
   301         CUnifiedCertStore* iCertStore;
       
   302         CCertAttributeFilter* iFilter;
       
   303         RFs iFs;
       
   304         CCTCertInfo* iCertInfo;
       
   305         CDesCArrayFlat*  iCertArray;        
       
   306         RMPointerArray<CCTCertInfo> iCertInfos;
       
   307         HBufC8* iCertBuf;
       
   308         MCTWritableCertStore *iTrustedSiteCertStore;
       
   309         HBufC* iCertLabel;
       
   310         HBufC8* iServerCert;
       
   311         RMPointerArray<HBufC8> iServerCerts;
       
   312         HBufC* iServerName;
       
   313         TBool iTrustedSite;
       
   314         TInt iHandleIndex;
       
   315         TPtr8 iCertPtr;
       
   316 
       
   317         CUnifiedKeyStore* iKeyStore;
       
   318         CCTKeyInfo* iKeyInfo;
       
   319         RMPointerArray<CCTKeyInfo> iKeyInfos;
       
   320         TCTKeyAttributeFilter iKeyFilter;
       
   321         HBufC* iText;
       
   322 
       
   323         TSaveCertInput iSaveCertInput;
       
   324         TValidationError iAuthFailReason;
       
   325         
       
   326         TBool& iDeleted;
       
   327         
       
   328         CAknQueryDialog* iQueryDialog;
       
   329         TBool iQueryDialogDeleted;
       
   330         
       
   331         CCTPinQueryDialog* iPinQueryDialog;
       
   332         TBool iPinQueryDialogDeleted;
       
   333         };
       
   334 
       
   335 #endif      // CTSECURITYDIALOGSAO_H
       
   336 
       
   337 // End of File