|
1 /* |
|
2 * Copyright (c) 2001-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 the License "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: |
|
15 * CRefSecurityDialog class implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalTechnology |
|
25 */ |
|
26 |
|
27 #ifndef __CREFSECURITYDIALOG_H__ |
|
28 #define __CREFSECURITYDIALOG_H__ |
|
29 |
|
30 #include "secdlgimpldefs.h" |
|
31 |
|
32 class CDialogRequester; |
|
33 |
|
34 /** |
|
35 * Reference implementation of the MSecurityDialog API. It wraps the arguments into |
|
36 * a form suitable for use with the RNotifier dialog framework. |
|
37 */ |
|
38 NONSHARABLE_CLASS(CRefSecurityDialog) : public CBase, public MSecurityDialog |
|
39 { |
|
40 public: |
|
41 ~CRefSecurityDialog(); |
|
42 static CRefSecurityDialog* NewL(); |
|
43 |
|
44 public: // from MSecurityDialog |
|
45 void ServerAuthenticationFailure(const TDesC8& aServerName,const TValidationError& aFailureReason,const TDesC8& aEncodedCert,TRequestStatus& aStatus ); |
|
46 void Release(); |
|
47 void EnterPIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue, |
|
48 TRequestStatus& aStatus ); |
|
49 void EnablePIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue, |
|
50 TRequestStatus& aStatus ); |
|
51 void DisablePIN( const TPINParams& aPINParams, TBool aRetry, TPINValue& aPINValue, |
|
52 TRequestStatus& aStatus ); |
|
53 void ChangePIN( const TPINParams& aPINParams, TBool aRetry, |
|
54 TPINValue& aOldPINValue, TPINValue& aNewPINValue, |
|
55 TRequestStatus& aStatus ); |
|
56 void UnblockPIN( const TPINParams& aBlockedPINParams, |
|
57 const TPINParams& aUnblockingPINParams, TBool aRetry, |
|
58 TPINValue& aUnblockingPINValue, TPINValue& aNewPINValue, |
|
59 TRequestStatus& aStatus ); |
|
60 void UnblockPINInClear( const TPINParams& aBlockedPINParams, |
|
61 const TPINParams& aUnblockingPINParams, TBool aRetry, |
|
62 TUnblockPINValue& aUnblockingPINValue, TPINValue& aNewPINValue, |
|
63 TRequestStatus& aStatus ); |
|
64 void Cancel(); |
|
65 void PINBlocked( const TPINParams& aPINParams, TRequestStatus& aStatus ); |
|
66 void TotalBlocked( const TPINParams& aPINParams, TRequestStatus& aStatus ); |
|
67 void EstablishSecureConnection( const TDesC8& aCertData, |
|
68 const RArray<TCTTokenObjectHandle>& aCertHandleList, |
|
69 MSecurityDialog::TConnectionType aConnectionType, |
|
70 TBool& aDoClientAuthentication, TCTTokenObjectHandle& aCertId, |
|
71 TRequestStatus& aStatus ); |
|
72 void SignText( const TDesC& aText, |
|
73 const RArray<TCTTokenObjectHandle>& aCertIdList, |
|
74 TCTTokenObjectHandle& aCertId, |
|
75 TRequestStatus& aStatus ); |
|
76 |
|
77 void HandleResponse( TInt aResult ); |
|
78 |
|
79 private: |
|
80 void ConstructL(); |
|
81 void DoBasicPINOperation( TSecurityDialogOperation aOperation, |
|
82 const TPINParams& aPINParams, TBool aRetry, TDes8& aPINValue, |
|
83 TRequestStatus& aStatus ); |
|
84 void InitClientStatus( TRequestStatus& aStatus ); |
|
85 |
|
86 private: |
|
87 CDialogRequester* iRequester; |
|
88 TSecurityDialogOperation iCurrentOperation; |
|
89 TRequestStatus* iClientStatus; |
|
90 TPINValue* iClientPINValuePtr; |
|
91 TUnblockPINValue* iClientUnblockPINValuePtr; |
|
92 TPINValue* iClientSecondPINValuePtr; |
|
93 TPINValueBuf iPINValueBuf; |
|
94 TTwoPINOutputBuf iTwoPINOutputBuf; |
|
95 TUnblockPINInClearOutputBuf iUnblockPINInClearOutputBuf; |
|
96 TSignInputBuf iSignInputBuf; |
|
97 TPtrC8 iVariableDataPtr; |
|
98 TCTTokenObjectHandle* iClientCertInfoHandlePtr; |
|
99 TBool* iClientDoClientAuthenticationPtr; |
|
100 TCTTokenObjectHandleBuf iCertInfoHandleBuf; |
|
101 TUnblockPINInputBuf iUnblockPINInputBuf; |
|
102 TPINInputBuf iPINInputBuf; |
|
103 TServerAuthenticationFailureOutputBuf iServerAuthenticationOutputBuf; |
|
104 }; |
|
105 |
|
106 /** |
|
107 * An AO used to call the notifier, which allows packaging and unpackaging of the |
|
108 * arguments and return values for the client. |
|
109 */ |
|
110 NONSHARABLE_CLASS(CDialogRequester) : public CActive |
|
111 { |
|
112 private: |
|
113 enum TState { KFillingVariableInputBuffer, KMakingRequest }; |
|
114 |
|
115 public: |
|
116 static CDialogRequester* NewL( CRefSecurityDialog& aSecDialog ); |
|
117 ~CDialogRequester(); |
|
118 void RequestDialog( const TDesC8& aData, TDes8& aResponse ); |
|
119 void RequestVariableBufferDialog( const TDesC8& aOperationData, |
|
120 const TDesC8& aVariableData, |
|
121 const RArray<TCTTokenObjectHandle>& aCertHandleList, |
|
122 TDes8& aResponse ); |
|
123 |
|
124 void RequestDialog(HBufC8* iInputBuffer, TDes8& aResponse); |
|
125 |
|
126 private: |
|
127 CDialogRequester( CRefSecurityDialog& aSecDialog ); |
|
128 void ConstructL(); |
|
129 |
|
130 private: // from CActive |
|
131 void RunL(); |
|
132 void DoCancel(); |
|
133 TInt RunError( TInt aError ); |
|
134 |
|
135 private: |
|
136 TState iState; |
|
137 RNotifier iNotifier; |
|
138 CRefSecurityDialog& iSecDialog; |
|
139 const TDesC8* iOperationDataPtr; |
|
140 const TDesC8* iVariableDataPtr; |
|
141 const RArray<TCTTokenObjectHandle>* iCertHandleListPtr; |
|
142 HBufC8* iInputBuffer; |
|
143 TDes8* iResponsePtr; |
|
144 }; |
|
145 |
|
146 #endif |