Update contrib.
2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
25 #ifndef __MCTAOSTORE_H__
26 #define __MCTAOSTORE_H__
30 /** The UID for the authentication object interface. */
31 const TInt KCTInterfaceAuthenticationObject = 0x101F51AE;
34 * A timeout value for an auth object indicating that it stays open until
37 const TInt KTimeoutNever = -1;
40 * A timeout value for an auth object indicating that the authentication data
41 * must be entered every time the protected objects are used.
43 const TInt KTimeoutImmediate = 0;
46 * The status of an authentication object.
48 enum TCTAuthenticationStatus
50 /** The authentication object is enabled. If it is not enabled, the objects protected
51 * by this authentication object can be accessed without authentication. */
53 /** The reference data cannot be changed. */
54 EChangeDisabled = 0x40,
55 /** The authentication cannot be unblocked. */
56 EUnblockDisabled = 0x20,
57 /** The authentication object can be disabled. */
58 EDisableAllowed = 0x10,
59 /** The authentication object is blocked, meaning that the
60 * unblocking PIN must be entered to re-enable the authentication object. */
61 EAuthObjectBlocked= 0x08,
65 * This class allows authentication objects to be queried and manipulated.
67 * Authentication objects are obtained from the MCTAuthenticationObjectList class,
68 * which is the class returned as the token interface.
70 class MCTAuthenticationObject: public MCTTokenObject
74 inline MCTAuthenticationObject(MCTToken& aToken);
76 // Listing Protected Objects
78 * Gets a list of all the objects that this authentication object protects.
80 * @param aObjects The returned objects will be appended to this array.
81 * @param aStatus Completed with the return code when the operation completes.
83 virtual void ListProtectedObjects(RMPointerArray<MCTTokenObject>& aObjects, TRequestStatus& aStatus) = 0;
85 /** Cancels an asynchronous ListProtectedObjects() operation. */
86 virtual void CancelListProtectedObjects() = 0;
88 // Changing the reference data
90 * Changes the reference data (e.g. PIN value).
92 * The security dialog component will prompt for the old and new reference data.
94 * The authentication object may not allow its reference data to be changed -
95 * this is indicated by the EChangeDisabled bit of Status() being set.
97 * @param aStatus Completed with the return code when the operation completes.
99 * @leave KErrNotFound If no reference data was originally set.
101 virtual void ChangeReferenceData(TRequestStatus &aStatus) = 0;
103 /** Cancels an asynchronous ChangeReferenceData() operation. */
104 virtual void CancelChangeReferenceData() = 0;
107 * Unblocks the authentication object.
109 * The security dialog component will prompt for the unblocking
110 * authentication object.
112 * It is only valid to call this method when the authentication object is
113 * blocked, ie when the EAuthObjectBlocked bit of Status() is set.
115 * The object may not allow unblocking (either because of failed unblock
116 * attempts or because it doesn't support the concept) - this is indicated by
117 * the EUnblockDisabled bit of Status() being set.
119 * @param aStatus Completed with the return code when the operation completes.
121 virtual void Unblock(TRequestStatus &aStatus) = 0;
123 /** Cancels an asynchronous Unblock() operation. */
124 virtual void CancelUnblock() = 0;
127 * Gets the status of the authentication object.
129 * @return See TCTAuthenticationStatus() for the format of the return value.
131 virtual TUint32 Status() const = 0;
133 // Enabling and Disabling
135 * Disables the authentication object.
137 * It is only valid to call this method if the object is enabled, indicated
138 * by the EEnabled bit of Status() being set.
140 * Also, the authentication object may not support being enabled/disabled -
141 * the EDisableAllowed bit of Status() must be set for this to work.
143 * @param aStatus Completed with the return code when the operation completes.
145 virtual void Disable(TRequestStatus &aStatus) = 0;
147 /** Cancels an asynchronous Disable() operation. */
148 virtual void CancelDisable() = 0;
151 * Enables the authentication object.
153 * It is only valid to call this method if the object is disabled, indicated
154 * by the EEnabled bit of Status() being clear.
156 * Also, the authentication object may not support being enabled/disabled -
157 * the EDisableAllowed bit of Status() must be set for this to work.
159 * @param aStatus Completed with the return code when the operation completes.
161 virtual void Enable(TRequestStatus &aStatus) = 0;
163 // Cancel an ongoing Enable operation
164 /** Cancels an asynchronous Enable() operation. */
165 virtual void CancelEnable() = 0;
168 * Opens the authentication object.
170 * This means that the protected objects can be accessed without provoking
171 * the authentication mechanism for the duration of the timeout period.
173 * Note that it is not strictly necessary to call this function, as the
174 * authentication object will be opened when any operation that needs it to
175 * be opened is called, but it is sometimes useful to control the timing of
176 * authentication dialogs. Note also that this function will do nothing if
177 * the authentication object is open, or if the authentication object
178 * requires the authentication data to be entered every time.
180 * @param aStatus Completed with the return code when the operation completes.
182 virtual void Open(TRequestStatus& aStatus) = 0;
185 * Closes an authentication object.
187 * @param aStatus Completed with the return code when the operation completes.
189 virtual void Close(TRequestStatus& aStatus) = 0;
192 * Gets the amount of time in seconds that the authentication object
193 * will remain open for, or 0 if it is closed.
195 * @param aStime Time in seconds when the operation completes.
196 * @param aStatus Completed with the return code when the operation completes.
198 virtual void TimeRemaining(TInt& aStime, TRequestStatus& aStatus) = 0;
201 * Sets the time in seconds for this authentication object.
203 * Permitted values include 0, meaning always ask, and -1,
204 * meaning until it's explicitly closed. Particular authentication
205 * objects might restrict the range of values permitted.
207 * @param aTime Time in seconds
208 * @param aStatus Completed with the return code when the operation completes
210 * @leave KErrArgument If the timeout specified is invalid.
212 virtual void SetTimeout(TInt aTime, TRequestStatus& aStatus) = 0;
215 * Gets the current timeout value, in seconds.
217 * For an explanation of the values, see SetTimeout().
219 * @param aTime Time in seconds.
220 * @param aStatus Completed with the return code when the operation completes.
222 virtual void Timeout(TInt& aTime, TRequestStatus& aStatus) = 0;
224 /** Cancels an asynchronous Open() operation. */
225 virtual void CancelOpen() {};
227 /** Cancels an asynchronous Close() operation. */
228 virtual void CancelClose() {};
230 /** Cancels an asynchronous TimeRemaining() operation. */
231 virtual void CancelTimeRemaining() {};
233 /** Cancels an asynchronous SetTimeout() operation. */
234 virtual void CancelSetTimeout() {};
236 /** Cancels an asynchronous Timeout() operation. */
237 virtual void CancelTimeout() {};
242 * An interface that enables clients to list all the authentication objects on
243 * a token, find out which objects they protect, and change/unblock/enable/disable them.
245 * It may be used to implement a 'PIN manager' control panel item. This could
246 * list the PINs (by label), allow one to be selected, list what it is used for
247 * (including information such as what operations on that object are protected
248 * by that PIN), and then allow the user to change, enable, disable, and unblock
251 * Note that no PINs appear anywhere in this API. The code implementing this
252 * API will display a PIN dialog via the secure dialog interface when a PIN is
253 * required. The main advantage of this is that if some hostile code were to
254 * capture a PIN, it couldn't do anything with it as none of the APIs take a
255 * PIN. A secondary benefit is that the same API can work with biometrics or
256 * other methods of authentication.
258 class MAuthenticationObjectList
262 * Gets a list of all the authenticaiton objects in the token.
264 * This is an asynchronous request.
266 * @param aAuthObjects On return, a list of all the authentication objects.
267 * @param aStatus The request status object; contains the result of the List() request
268 * when complete. Set to KErrCancel if an outstanding request is cancelled.
270 // @param aAuthObjects The returned authentication objects will be appended to this array
271 // @param aStatus This will be completed with the final status code
272 virtual void List(RMPointerArray<MCTAuthenticationObject>& aAuthObjects, TRequestStatus& aStatus) = 0;
275 * Cancels an asynchronous List() operation.
277 * The operation completes with KErrCancel.
279 virtual void CancelList() = 0;
284 * The class returned as the token interface.
286 * The class does not define any extra member functions or data.
288 class MCTAuthenticationObjectList : public MCTTokenInterface,
289 public MAuthenticationObjectList
293 inline MCTAuthenticationObject::MCTAuthenticationObject(MCTToken& aToken)
294 : MCTTokenObject(aToken)
298 #endif //__MCTAOSTORE_H__