|
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 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 * CPinPluginAO declaration |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef PIN_PLUGINAO_H |
|
27 #define PIN_PLUGINAO_H |
|
28 |
|
29 #include "pinplugindialog.h" |
|
30 #include "pinplugindb.h" |
|
31 #include "pinpanic.h" |
|
32 |
|
33 class CPinPluginAO : public CActive |
|
34 { |
|
35 public: |
|
36 /** static methods to constuct the object of the CPinpluginAO */ |
|
37 static CPinPluginAO* NewL(TInt aPinSize, TInt aPinMinSize, TInt aPinMaxSize, TInt aRetryCount); |
|
38 static CPinPluginAO* NewLC(TInt aPinSize, TInt aPinMinSize, TInt aPinMaxSize, TInt aRetryCount); |
|
39 /** Destructor */ |
|
40 ~CPinPluginAO(); |
|
41 public: //CAuthPluginInterface |
|
42 void Identify(AuthServer::TIdentityId& aId, const TDesC& aClientMessage, |
|
43 HBufC8*& aResult, TRequestStatus& aRequest); |
|
44 void Train(AuthServer::TIdentityId aId, HBufC8*& aResult, TRequestStatus& aRequest); |
|
45 TInt Forget(AuthServer::TIdentityId aId); |
|
46 TInt DefaultData(AuthServer::TIdentityId aId, HBufC8*& aOutputBuf); |
|
47 void ResetL(AuthServer::TIdentityId aId, const TDesC& aRegistrationData, HBufC8*& aResult); |
|
48 |
|
49 private: //Active |
|
50 void DoCancel(); |
|
51 void RunL(); |
|
52 TInt RunError(TInt aError); |
|
53 private: |
|
54 /** Constructor */ |
|
55 CPinPluginAO(TInt aPinSize, TInt aPinMinSize, TInt aPinMaxSize, TInt aRetryCount); |
|
56 |
|
57 /** Second Phase Constructor */ |
|
58 void ConstructL(); |
|
59 |
|
60 /** |
|
61 Issue a Request for Identify Dialog upto iRetryCount times to |
|
62 PinPluginDialog. If the pinvalue received is wrong for all the |
|
63 retries, reset the identityId as KUnknownIdentity. |
|
64 */ |
|
65 void IdentifyId(); |
|
66 |
|
67 /** |
|
68 Issue a Request for Train Dialog to PinPluginDialog. |
|
69 It will generate 4 random pin of length iNewPinSize and send |
|
70 the pin Numbers and iNewPinSize to PinpluginDialog. Once it completed |
|
71 it have the selected pin index and new pin size which is used to generate |
|
72 another set of pin numbers for the next dialogs if required. |
|
73 |
|
74 @panic EPinPanicInvalidPinLength if plugin receives invalid pinlength fron Dialog Notifier |
|
75 */ |
|
76 void TrainIdL(); |
|
77 |
|
78 /** |
|
79 It will generate KeyHash for the pin number given in the Identify Dialog. |
|
80 and verify the keyHash and Id with DB entries. If same, the state will be |
|
81 changed to EInfo and message is set to EPinPluginIdentificationSuccess |
|
82 which is used to display info message to the user. |
|
83 If not, same state will be maintained so that it will ask another Identify |
|
84 dialog to the user. |
|
85 */ |
|
86 void IdentifyResultL(); |
|
87 |
|
88 /** |
|
89 It will add/update the DB with the pin selected in Pin Train/ReTrain Dialog. |
|
90 |
|
91 @panic EPinPanicIncorrectIndex if plugin receives index values otherthan 0 -3 |
|
92 */ |
|
93 void AddTrainResultToDBL(); |
|
94 |
|
95 /** |
|
96 It will generate two KeyHash for the pin value using SHA1 Algorithm |
|
97 Intermediate result will return to the Authentication server whereas |
|
98 final result is stored in the DB. |
|
99 |
|
100 @param aPinValue The Pin number for which Hash value required |
|
101 @param aIdentityKey aIdentityKey is updated with intermediate KeyHash generated. |
|
102 @return It will return the final KeyHash Value generated |
|
103 */ |
|
104 HBufC8* GenerateKeyHashL(TPinValue& aPinValue, HBufC8*& aIdentityKey); |
|
105 |
|
106 /** |
|
107 It will generate four Unique Pins which is not used any of the |
|
108 existing identities. |
|
109 |
|
110 @param aPinList On return, it holds the array of Pin numbers generated |
|
111 @param idKeyList On return, it holds the array of intermediate KeyHash |
|
112 values for the Pin Numbers in the aPinList |
|
113 @param idKeyHashList On return, it holds the array of Final KeyHash values |
|
114 for the Pin Numbers in the aPinList |
|
115 */ |
|
116 void GenerateUniquePinsL(RPointerArray<TPinValue>& aPinList, RPointerArray<HBufC8>& idKeyList, |
|
117 RPointerArray<HBufC8>& idKeyHashList); |
|
118 private: |
|
119 enum TProcessState |
|
120 { |
|
121 EIdentify, |
|
122 EIdentifyResult, |
|
123 ETrain, |
|
124 ETrainResult, |
|
125 EInfo, |
|
126 EFinished |
|
127 }; |
|
128 CPinPluginDialog* iPinPluginDialog; |
|
129 CPinPluginDB* iPinPluginDb; |
|
130 TRequestStatus* iRequestStatus; |
|
131 TProcessState iState; |
|
132 TInt iIndex; |
|
133 TPinValue iPinValue; |
|
134 AuthServer::TIdentityId iIdentityId; |
|
135 AuthServer::TIdentityId* iIdentityIdPtr; |
|
136 HBufC8** iResult; |
|
137 TPinPluginDialogResult* iDialogResult; |
|
138 TPinPluginInfoMessage iMessage; |
|
139 |
|
140 TInt iRetryCount; |
|
141 TInt iRetryRefCount; |
|
142 TInt iPinSize; |
|
143 TInt iPinMinSize; |
|
144 TInt iPinMaxSize; |
|
145 TInt iNewPinSize; |
|
146 |
|
147 RPointerArray<TPinValue> iPinList; |
|
148 RPointerArray<HBufC8> iIdKeyList; |
|
149 RPointerArray<HBufC8> iIdKeyHashList; |
|
150 |
|
151 //Displayable text string |
|
152 const HBufC* iClientMessage; |
|
153 |
|
154 }; |
|
155 |
|
156 #endif /* PIN_PLUGINAO_H */ |
|
157 |