os/security/cryptomgmtlibs/cryptotokenfw/source/ctframework/CRefSecurityDialog.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* CRefSecurityDialog class implementation
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file 
sl@0
    22
 @internalTechnology
sl@0
    23
*/
sl@0
    24
 
sl@0
    25
#ifndef __CREFSECURITYDIALOG_H__
sl@0
    26
#define __CREFSECURITYDIALOG_H__
sl@0
    27
sl@0
    28
#include "secdlgImplDefs.h"
sl@0
    29
sl@0
    30
class CDialogRequester;
sl@0
    31
sl@0
    32
/**
sl@0
    33
 * Reference implementation of the MSecurityDialog API. It wraps the arguments into
sl@0
    34
 * a form suitable for use with the RNotifier dialog framework.
sl@0
    35
 */
sl@0
    36
NONSHARABLE_CLASS(CRefSecurityDialog) : public CBase, public MSecurityDialog 
sl@0
    37
	{
sl@0
    38
public:
sl@0
    39
	 ~CRefSecurityDialog();
sl@0
    40
	 static CRefSecurityDialog* NewL();
sl@0
    41
sl@0
    42
public: // from MSecurityDialog
sl@0
    43
     void ServerAuthenticationFailure(const TDesC8& aServerName,const TValidationError& aFailureReason,const TDesC8& aEncodedCert,TRequestStatus& aStatus );
sl@0
    44
	 void Release();
sl@0
    45
	 void EnterPIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue,
sl@0
    46
						   TRequestStatus& aStatus );
sl@0
    47
	 void EnablePIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue,
sl@0
    48
							TRequestStatus& aStatus );
sl@0
    49
	 void DisablePIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue,
sl@0
    50
							 TRequestStatus& aStatus );
sl@0
    51
	 void ChangePIN( const TPINParams& aPINParams, TBool aRetry,
sl@0
    52
							TPINValue& aOldPINValue, TPINValue& aNewPINValue,
sl@0
    53
							TRequestStatus& aStatus );
sl@0
    54
	 void UnblockPIN( const TPINParams& aBlockedPINParams,
sl@0
    55
							 const TPINParams& aUnblockingPINParams, TBool aRetry,
sl@0
    56
							 TPINValue& aUnblockingPINValue, TPINValue& aNewPINValue,
sl@0
    57
							 TRequestStatus& aStatus );
sl@0
    58
	 void UnblockPINInClear( const TPINParams& aBlockedPINParams,
sl@0
    59
							 const TPINParams& aUnblockingPINParams, TBool aRetry,
sl@0
    60
							 TUnblockPINValue& aUnblockingPINValue, TPINValue& aNewPINValue,
sl@0
    61
							 TRequestStatus& aStatus );
sl@0
    62
	 void Cancel();
sl@0
    63
	 void PINBlocked( const TPINParams& aPINParams, TRequestStatus& aStatus );
sl@0
    64
	 void TotalBlocked( const TPINParams& aPINParams, TRequestStatus& aStatus );
sl@0
    65
	 void EstablishSecureConnection( const TDesC8& aCertData,
sl@0
    66
						const RArray<TCTTokenObjectHandle>& aCertHandleList,
sl@0
    67
						MSecurityDialog::TConnectionType aConnectionType,
sl@0
    68
						TBool& aDoClientAuthentication, TCTTokenObjectHandle& aCertId,
sl@0
    69
						TRequestStatus& aStatus );
sl@0
    70
	 void SignText( const TDesC& aText,
sl@0
    71
							const RArray<TCTTokenObjectHandle>& aCertIdList,
sl@0
    72
							TCTTokenObjectHandle& aCertId,
sl@0
    73
							TRequestStatus& aStatus );
sl@0
    74
sl@0
    75
	void HandleResponse( TInt aResult );
sl@0
    76
sl@0
    77
private:
sl@0
    78
	void ConstructL();
sl@0
    79
	void DoBasicPINOperation( TSecurityDialogOperation aOperation,
sl@0
    80
								const TPINParams& aPINParams, TBool aRetry, TDes8& aPINValue,
sl@0
    81
								TRequestStatus& aStatus );
sl@0
    82
	void InitClientStatus( TRequestStatus& aStatus );
sl@0
    83
sl@0
    84
private:
sl@0
    85
	CDialogRequester* iRequester;
sl@0
    86
	TSecurityDialogOperation iCurrentOperation;
sl@0
    87
	TRequestStatus* iClientStatus;
sl@0
    88
	TPINValue* iClientPINValuePtr;
sl@0
    89
	TUnblockPINValue* iClientUnblockPINValuePtr;
sl@0
    90
	TPINValue* iClientSecondPINValuePtr;
sl@0
    91
	TPINValueBuf iPINValueBuf;
sl@0
    92
	TTwoPINOutputBuf iTwoPINOutputBuf;
sl@0
    93
	TUnblockPINInClearOutputBuf iUnblockPINInClearOutputBuf;
sl@0
    94
	TSignInputBuf iSignInputBuf;
sl@0
    95
	TPtrC8 iVariableDataPtr;
sl@0
    96
	TCTTokenObjectHandle* iClientCertInfoHandlePtr;
sl@0
    97
	TBool* iClientDoClientAuthenticationPtr;
sl@0
    98
	TCTTokenObjectHandleBuf iCertInfoHandleBuf;
sl@0
    99
	TUnblockPINInputBuf iUnblockPINInputBuf;
sl@0
   100
	TPINInputBuf iPINInputBuf;
sl@0
   101
	TServerAuthenticationFailureOutputBuf iServerAuthenticationOutputBuf;
sl@0
   102
	};
sl@0
   103
sl@0
   104
/**
sl@0
   105
 * An AO used to call the notifier, which allows packaging and unpackaging of the
sl@0
   106
 * arguments and return values for the client.
sl@0
   107
 */
sl@0
   108
NONSHARABLE_CLASS(CDialogRequester) : public CActive
sl@0
   109
	{
sl@0
   110
private:
sl@0
   111
	enum TState { KFillingVariableInputBuffer, KMakingRequest };
sl@0
   112
sl@0
   113
public:
sl@0
   114
	static CDialogRequester* NewL( CRefSecurityDialog& aSecDialog );
sl@0
   115
	~CDialogRequester();
sl@0
   116
	void RequestDialog( const TDesC8& aData, TDes8& aResponse );
sl@0
   117
	void RequestVariableBufferDialog( const TDesC8& aOperationData,
sl@0
   118
										const TDesC8& aVariableData,
sl@0
   119
										const RArray<TCTTokenObjectHandle>& aCertHandleList,
sl@0
   120
										TDes8& aResponse );
sl@0
   121
sl@0
   122
	void RequestDialog(HBufC8* iInputBuffer, TDes8& aResponse);
sl@0
   123
sl@0
   124
private:
sl@0
   125
	CDialogRequester( CRefSecurityDialog& aSecDialog );
sl@0
   126
	void ConstructL();
sl@0
   127
sl@0
   128
private: // from CActive
sl@0
   129
	void RunL();
sl@0
   130
	void DoCancel();
sl@0
   131
	TInt RunError( TInt aError );
sl@0
   132
sl@0
   133
private:
sl@0
   134
	TState iState;
sl@0
   135
	RNotifier iNotifier;
sl@0
   136
	CRefSecurityDialog& iSecDialog;
sl@0
   137
	const TDesC8* iOperationDataPtr;
sl@0
   138
	const TDesC8* iVariableDataPtr;
sl@0
   139
	const RArray<TCTTokenObjectHandle>* iCertHandleListPtr;
sl@0
   140
	HBufC8* iInputBuffer;
sl@0
   141
	TDes8* iResponsePtr;
sl@0
   142
	};
sl@0
   143
sl@0
   144
#endif