os/security/cryptomgmtlibs/cryptotokenfw/source/ctframework/CRefSecurityDialog.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptomgmtlibs/cryptotokenfw/source/ctframework/CRefSecurityDialog.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,144 @@
     1.4 +/*
     1.5 +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* CRefSecurityDialog class implementation
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file 
    1.25 + @internalTechnology
    1.26 +*/
    1.27 + 
    1.28 +#ifndef __CREFSECURITYDIALOG_H__
    1.29 +#define __CREFSECURITYDIALOG_H__
    1.30 +
    1.31 +#include "secdlgImplDefs.h"
    1.32 +
    1.33 +class CDialogRequester;
    1.34 +
    1.35 +/**
    1.36 + * Reference implementation of the MSecurityDialog API. It wraps the arguments into
    1.37 + * a form suitable for use with the RNotifier dialog framework.
    1.38 + */
    1.39 +NONSHARABLE_CLASS(CRefSecurityDialog) : public CBase, public MSecurityDialog 
    1.40 +	{
    1.41 +public:
    1.42 +	 ~CRefSecurityDialog();
    1.43 +	 static CRefSecurityDialog* NewL();
    1.44 +
    1.45 +public: // from MSecurityDialog
    1.46 +     void ServerAuthenticationFailure(const TDesC8& aServerName,const TValidationError& aFailureReason,const TDesC8& aEncodedCert,TRequestStatus& aStatus );
    1.47 +	 void Release();
    1.48 +	 void EnterPIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue,
    1.49 +						   TRequestStatus& aStatus );
    1.50 +	 void EnablePIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue,
    1.51 +							TRequestStatus& aStatus );
    1.52 +	 void DisablePIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue,
    1.53 +							 TRequestStatus& aStatus );
    1.54 +	 void ChangePIN( const TPINParams& aPINParams, TBool aRetry,
    1.55 +							TPINValue& aOldPINValue, TPINValue& aNewPINValue,
    1.56 +							TRequestStatus& aStatus );
    1.57 +	 void UnblockPIN( const TPINParams& aBlockedPINParams,
    1.58 +							 const TPINParams& aUnblockingPINParams, TBool aRetry,
    1.59 +							 TPINValue& aUnblockingPINValue, TPINValue& aNewPINValue,
    1.60 +							 TRequestStatus& aStatus );
    1.61 +	 void UnblockPINInClear( const TPINParams& aBlockedPINParams,
    1.62 +							 const TPINParams& aUnblockingPINParams, TBool aRetry,
    1.63 +							 TUnblockPINValue& aUnblockingPINValue, TPINValue& aNewPINValue,
    1.64 +							 TRequestStatus& aStatus );
    1.65 +	 void Cancel();
    1.66 +	 void PINBlocked( const TPINParams& aPINParams, TRequestStatus& aStatus );
    1.67 +	 void TotalBlocked( const TPINParams& aPINParams, TRequestStatus& aStatus );
    1.68 +	 void EstablishSecureConnection( const TDesC8& aCertData,
    1.69 +						const RArray<TCTTokenObjectHandle>& aCertHandleList,
    1.70 +						MSecurityDialog::TConnectionType aConnectionType,
    1.71 +						TBool& aDoClientAuthentication, TCTTokenObjectHandle& aCertId,
    1.72 +						TRequestStatus& aStatus );
    1.73 +	 void SignText( const TDesC& aText,
    1.74 +							const RArray<TCTTokenObjectHandle>& aCertIdList,
    1.75 +							TCTTokenObjectHandle& aCertId,
    1.76 +							TRequestStatus& aStatus );
    1.77 +
    1.78 +	void HandleResponse( TInt aResult );
    1.79 +
    1.80 +private:
    1.81 +	void ConstructL();
    1.82 +	void DoBasicPINOperation( TSecurityDialogOperation aOperation,
    1.83 +								const TPINParams& aPINParams, TBool aRetry, TDes8& aPINValue,
    1.84 +								TRequestStatus& aStatus );
    1.85 +	void InitClientStatus( TRequestStatus& aStatus );
    1.86 +
    1.87 +private:
    1.88 +	CDialogRequester* iRequester;
    1.89 +	TSecurityDialogOperation iCurrentOperation;
    1.90 +	TRequestStatus* iClientStatus;
    1.91 +	TPINValue* iClientPINValuePtr;
    1.92 +	TUnblockPINValue* iClientUnblockPINValuePtr;
    1.93 +	TPINValue* iClientSecondPINValuePtr;
    1.94 +	TPINValueBuf iPINValueBuf;
    1.95 +	TTwoPINOutputBuf iTwoPINOutputBuf;
    1.96 +	TUnblockPINInClearOutputBuf iUnblockPINInClearOutputBuf;
    1.97 +	TSignInputBuf iSignInputBuf;
    1.98 +	TPtrC8 iVariableDataPtr;
    1.99 +	TCTTokenObjectHandle* iClientCertInfoHandlePtr;
   1.100 +	TBool* iClientDoClientAuthenticationPtr;
   1.101 +	TCTTokenObjectHandleBuf iCertInfoHandleBuf;
   1.102 +	TUnblockPINInputBuf iUnblockPINInputBuf;
   1.103 +	TPINInputBuf iPINInputBuf;
   1.104 +	TServerAuthenticationFailureOutputBuf iServerAuthenticationOutputBuf;
   1.105 +	};
   1.106 +
   1.107 +/**
   1.108 + * An AO used to call the notifier, which allows packaging and unpackaging of the
   1.109 + * arguments and return values for the client.
   1.110 + */
   1.111 +NONSHARABLE_CLASS(CDialogRequester) : public CActive
   1.112 +	{
   1.113 +private:
   1.114 +	enum TState { KFillingVariableInputBuffer, KMakingRequest };
   1.115 +
   1.116 +public:
   1.117 +	static CDialogRequester* NewL( CRefSecurityDialog& aSecDialog );
   1.118 +	~CDialogRequester();
   1.119 +	void RequestDialog( const TDesC8& aData, TDes8& aResponse );
   1.120 +	void RequestVariableBufferDialog( const TDesC8& aOperationData,
   1.121 +										const TDesC8& aVariableData,
   1.122 +										const RArray<TCTTokenObjectHandle>& aCertHandleList,
   1.123 +										TDes8& aResponse );
   1.124 +
   1.125 +	void RequestDialog(HBufC8* iInputBuffer, TDes8& aResponse);
   1.126 +
   1.127 +private:
   1.128 +	CDialogRequester( CRefSecurityDialog& aSecDialog );
   1.129 +	void ConstructL();
   1.130 +
   1.131 +private: // from CActive
   1.132 +	void RunL();
   1.133 +	void DoCancel();
   1.134 +	TInt RunError( TInt aError );
   1.135 +
   1.136 +private:
   1.137 +	TState iState;
   1.138 +	RNotifier iNotifier;
   1.139 +	CRefSecurityDialog& iSecDialog;
   1.140 +	const TDesC8* iOperationDataPtr;
   1.141 +	const TDesC8* iVariableDataPtr;
   1.142 +	const RArray<TCTTokenObjectHandle>* iCertHandleListPtr;
   1.143 +	HBufC8* iInputBuffer;
   1.144 +	TDes8* iResponsePtr;
   1.145 +	};
   1.146 +
   1.147 +#endif