1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/cryptotokenfw/inc/secdlgImplDefs.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,341 @@
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 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedPartner
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __SECDLGIMPLDEFS_H__
1.29 +#define __SECDLGIMPLDEFS_H__
1.30 +
1.31 +#include <e32std.h>
1.32 +
1.33 +#include <secdlg.h>
1.34 +
1.35 +/** */
1.36 +// KUidSecurityDialogNotifier is named KUidWIMDialogNotifier in the UID database
1.37 +const TUid KUidSecurityDialogNotifier = { 0x101F3CBB };
1.38 +
1.39 +/** */
1.40 +typedef TUint TSecurityDialogNotification;
1.41 +
1.42 +/** */
1.43 +typedef TPckgBuf<TSecurityDialogNotification> TSecurityDialogNotificationBuf;
1.44 +
1.45 +
1.46 +/**
1.47 + * Defines the operations provided by the security dialog.
1.48 + *
1.49 + * It is used to identify the operation when transferring over to the notifier plugin.
1.50 + */
1.51 +enum TSecurityDialogOperation
1.52 + {
1.53 + /** Secure connection */
1.54 + ESecureConnection = 0x01,
1.55 + /** Sign text */
1.56 + ESignText = 0x02,
1.57 + /** Enter PIN */
1.58 + EEnterPIN = 0x04,
1.59 + /** Enable PIN */
1.60 + EEnablePIN = 0x08,
1.61 + /** Disable PIN */
1.62 + EDisablePIN = 0x10,
1.63 + /** Change PIN */
1.64 + EChangePIN = 0x20,
1.65 + /** Unblock PIN */
1.66 + EUnblockPIN = 0x40,
1.67 + /** PIN blocked */
1.68 + EPINBlocked = 0x80,
1.69 + /** Total blocked */
1.70 + ETotalBlocked = 0x100,
1.71 + /** Unblock PIN in clear */
1.72 + EUnblockPINInClear = 0x200,
1.73 + /** ServerAuthenticationFailure */
1.74 + EServerAuthenticationFailure = 0x400
1.75 + };
1.76 +
1.77 +/** */
1.78 +const TInt KSecurityDialogOperationMask = 0xFFFF;
1.79 +const TInt KServerNameBuf = 0xFF; // 0xFF = 255
1.80 +const TInt KEncodedCertBuf = 0x400; // 0x400 = 1024
1.81 +
1.82 +/** Security dialog error condition */
1.83 +enum TSecurityDialogErrorCondition
1.84 + {
1.85 + /** Incorrect PIN value */
1.86 + EPINValueIncorrect = 0x10000000
1.87 + };
1.88 +
1.89 +/** */
1.90 +//Passed back in TRequestStatus, if client agrees to authenticate/ The client TRequeststatus never gets set to this
1.91 +const TInt KClientAuthenticationRequested = 1;
1.92 +
1.93 +/**
1.94 + * Class used with corresponding TPckgBuf to build buffer for the
1.95 + * Server Authentication Failure Dialog operation.
1.96 + */
1.97 +class TServerAuthenticationFailureInput
1.98 + {
1.99 +public:
1.100 + /** EServerAuthenticationFailure */
1.101 + TSecurityDialogNotification iOperation;
1.102 +
1.103 + /** Server name */
1.104 + TInt iServerNameLength;
1.105 +
1.106 + /** Encoded Certificate */
1.107 + TInt iEncodedCertLength;
1.108 +
1.109 + /** Failure Reason */
1.110 + TValidationError iFailureReason;
1.111 + };
1.112 +
1.113 +/** */
1.114 +typedef TPckgBuf<TServerAuthenticationFailureInput> TServerAuthenticationFailureInputBuf;
1.115 +
1.116 +/**
1.117 + * The input buffer for the secure connection and sign text operations.
1.118 + */
1.119 +class TSignInput
1.120 + {
1.121 +public:
1.122 + /** */
1.123 + TSecurityDialogNotification iOperation;
1.124 +
1.125 + /** */
1.126 + TUint iVariableDataSize;
1.127 +
1.128 + /** */
1.129 + TUint iCertHandleArrayTotal;
1.130 +
1.131 + /**
1.132 + * Whether to do client authentication
1.133 + *
1.134 + * Used only for secure connection dialog
1.135 + */
1.136 + TBool iDoClientAuthentication;
1.137 +
1.138 + /** The connection type */
1.139 + MSecurityDialog::TConnectionType iConnectionType;
1.140 + };
1.141 +
1.142 +/** */
1.143 +typedef TPckgBuf<TSignInput> TSignInputBuf;
1.144 +
1.145 +/** */
1.146 +typedef TPckgBuf<TCTTokenObjectHandle> TCTTokenObjectHandleBuf;
1.147 +
1.148 +
1.149 +/**
1.150 + * Input data for the EEnterPIN, EChangePIN, EPINBlocked operations.
1.151 + */
1.152 +class TPINInput
1.153 + {
1.154 +public:
1.155 + /** */
1.156 + TSecurityDialogNotification iOperation;
1.157 +
1.158 + /** Information associated with the PIN */
1.159 + TPINParams iPIN;
1.160 + };
1.161 +
1.162 +/** */
1.163 +typedef TPckgBuf<TPINInput> TPINInputBuf;
1.164 +
1.165 +
1.166 +
1.167 +/**
1.168 + * Input data for the EUnblockPIN operation.
1.169 + */
1.170 +class TUnblockPINInput
1.171 + {
1.172 +public:
1.173 + TSecurityDialogNotification iOperation;
1.174 + TPINParams iPIN;
1.175 + TPINParams iUnblockPIN;
1.176 + };
1.177 +
1.178 +/** */
1.179 +typedef TPckgBuf<TUnblockPINInput> TUnblockPINInputBuf;
1.180 +
1.181 +/**
1.182 + * Output from the EServerAuthenticationFailure operations.
1.183 + */
1.184 + /** Security dialog error condition */
1.185 +enum TServerAuthenticationFailureDialogResult
1.186 + {
1.187 + EContinue = 0x01,
1.188 + EStop = 0x02
1.189 + };
1.190 +/** */
1.191 +typedef TPckgBuf<TServerAuthenticationFailureDialogResult> TServerAuthenticationFailureOutputBuf;
1.192 +
1.193 +/**
1.194 + * Output from the EChangePIN and EUnblockPIN operations.
1.195 + */
1.196 +class TTwoPINOutput
1.197 + {
1.198 +public:
1.199 + // This could be for the current PIN or the unblocking PIN
1.200 + TPINValue iPINValueToCheck;
1.201 + TPINValue iNewPINValue;
1.202 + };
1.203 +
1.204 +/** */
1.205 +typedef TPckgBuf<TTwoPINOutput> TTwoPINOutputBuf;
1.206 +
1.207 +/** */
1.208 +typedef TPckgBuf<TPINValue> TPINValueBuf;
1.209 +
1.210 +
1.211 +
1.212 +/**
1.213 + * Output from the EUnblockPINInClear operation.
1.214 + */
1.215 +class TUnblockPINInClearOutput
1.216 + {
1.217 +public:
1.218 + // This could be for the current PIN or the unblocking PIN
1.219 + TUnblockPINValue iPINValueToCheck;
1.220 + TPINValue iNewPINValue;
1.221 + };
1.222 +
1.223 +/** */
1.224 +typedef TPckgBuf<TUnblockPINInClearOutput> TUnblockPINInClearOutputBuf;
1.225 +
1.226 +
1.227 +/**
1.228 + * This class is used by the reference implementation of the security dialog,
1.229 + * CRefSecurityDialog, to pack the notifier buffer for the Server
1.230 + * Authentication Failure Dialog operation, and by the notifier server plugin
1.231 + * to unpack the buffer.
1.232 + */
1.233 +
1.234 +class CServerAuthenticationFailureInput : public CBase
1.235 + {
1.236 +public:
1.237 +
1.238 + virtual ~CServerAuthenticationFailureInput();
1.239 +
1.240 + /**
1.241 + * @internalComponent
1.242 + *
1.243 + * Static constructor function that uses the data passed in the call to
1.244 + * MSecurityDialog::ServerAuthenticationFailure to instantiate the object.
1.245 + *
1.246 + * Depending on the value of aCreateOwnBuffers, the object can allocate
1.247 + * new buffers with copies of the server name and encoded cert data, or it
1.248 + * can use pointers to the buffers for the existing descriptors. It should
1.249 + * only use the existing buffers if they won't be freed before an input
1.250 + * buffer for the notifier is created using PackBufferL.
1.251 + *
1.252 + * @param aServerName Name of the server with the certificate that
1.253 + * failed authentication.
1.254 + * @param aFailureReason Reason for certificate authentication failure.
1.255 + * @param aEncodedCert Encoded X509 Certificate data.
1.256 + * @param aCreateOwnBuffers Indicates whether new heap buffers are needed.
1.257 + *
1.258 + * @return The new CServerAuthenticationFailureInput
1.259 + * object. */
1.260 +
1.261 + static CServerAuthenticationFailureInput* NewL(const TDesC8& aServerName,const TValidationError& aFailureReason, const TDesC8& aEncodedCert, const TBool aCreateOwnBuffers = EFalse);
1.262 + /** @internalComponent */
1.263 + static CServerAuthenticationFailureInput* NewLC(const TDesC8& aServerName,const TValidationError& aFailureReason, const TDesC8& aEncodedCert, const TBool aCreateOwnBuffers = EFalse);
1.264 +
1.265 + /**
1.266 + * Static constructor function that constructs the object using the data
1.267 + * in a supplied buffer. This can be used in the implementation of a
1.268 + * plugin for the extended notifier framework; the buffer supplied to the
1.269 + * notifier for this dialog operation will be in the correct format to
1.270 + * construct the class with this function.
1.271 + *
1.272 + * Depending on the value of aCreateOwnBuffers, new buffers can be
1.273 + * allocated to hold copies of the server name and encoded cert data, or
1.274 + * the object can use pointers to the data positions within the input
1.275 + * buffer. It should only use the existing buffer if it will persist
1.276 + * until the data is no longer needed.
1.277 + *
1.278 + * @param aBuffer A data buffer containing the data needed
1.279 + * for the dialog.
1.280 + * @param aCreateOwnBuffers Indicates whether new heap buffers are
1.281 + * needed.
1.282 + *
1.283 + * @return The new CServerAuthenticationFailureInput
1.284 + * object. */
1.285 +
1.286 + IMPORT_C static CServerAuthenticationFailureInput* NewL(const TDesC8& aBuffer, const TBool aCreateOwnBuffers = EFalse);
1.287 + IMPORT_C static CServerAuthenticationFailureInput* NewLC(const TDesC8& aBuffer, const TBool aCreateOwnBuffers = EFalse);
1.288 +
1.289 +
1.290 + /**
1.291 + * Gets the reason for validation failure.
1.292 + *
1.293 + * @return The failure reason. */
1.294 + IMPORT_C TValidationError FailureReason();
1.295 +
1.296 + /**
1.297 + * Sets the supplied TPtrC8 to point to the buffer for the server name.
1.298 + *
1.299 + * @param aServerNamePtr A reference to a TPtrC8 to set to point to
1.300 + * the server name data. */
1.301 + IMPORT_C void GetServerName(TPtrC8& aServerNamePtr);
1.302 +
1.303 + /**
1.304 + * Sets the supplied TPtrC8 to point to the buffer for the encoded cert.
1.305 + *
1.306 + * @param aServerNamePtr A reference to a TPtrC8 to set to point to
1.307 + * the encoded cert data. */
1.308 + IMPORT_C void GetEncodedCert(TPtrC8& aEncodedCertPtr);
1.309 +
1.310 + /**
1.311 + * @internalComponent
1.312 + *
1.313 + * Allocates and fills a heap buffer with the data to be sent to the
1.314 + * notifier server. Ownership of this buffer passes to the calling
1.315 + * method.
1.316 + *
1.317 + * @return The allocated buffer. */
1.318 +
1.319 + HBufC8* PackBufferL() const;
1.320 +
1.321 +private:
1.322 + CServerAuthenticationFailureInput();
1.323 +
1.324 + void ConstructL(const TDesC8& aServerName,const TValidationError& aFailureReason, const TDesC8& aEncodedCert, const TBool aCreateOwnBuffers = EFalse);
1.325 + void ConstructL(const TDesC8& aBuffer, const TBool aCreateOwnBuffers = EFalse);
1.326 +
1.327 +private:
1.328 + /** EServerAuthenticationFailure */
1.329 + TSecurityDialogNotification iOperation;
1.330 +
1.331 + /** Failure Reason */
1.332 + TValidationError iFailureReason;
1.333 +
1.334 + /** Server name */
1.335 + HBufC8* iServerName;
1.336 + TPtrC8 iServerNamePtr;
1.337 +
1.338 + /** Encoded Certificate */
1.339 + HBufC8* iEncodedCert;
1.340 + TPtrC8 iEncodedCertPtr;
1.341 +
1.342 + };
1.343 +
1.344 +#endif