telephonyserverplugins/simtsy/src/csimsmartcardauth.h
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include <etelmm.h>
       
    21 #include <et_phone.h>
       
    22 #include "CSimPhone.h"
       
    23 
       
    24 class CSimPhone;
       
    25 class CTestConfigSection;
       
    26 
       
    27 class CSimSmartCardAuth : public CBase
       
    28 	{
       
    29 public:
       
    30 	static CSimSmartCardAuth* NewL(CSimPhone* aPhone);
       
    31 	~CSimSmartCardAuth();
       
    32 
       
    33 	TInt GetScAuthenticationData(const TTsyReqHandle aTsyReqHandle, TDes8* aPckg1, const RMobilePhone::TAID* aAID);
       
    34 	TInt GetScAuthenticationDataCancel(const TTsyReqHandle aTsyReqHandle);
       
    35 
       
    36 private:
       
    37 	CSimSmartCardAuth(CSimPhone *aPhone);
       
    38 	void ConstructL();
       
    39 
       
    40 	void ParseAuthInfoL();
       
    41 	void ParseGBAAuthInfoL();
       
    42 	void ParseMBMSAuthInfoL();
       
    43 
       
    44 	const CTestConfigSection* CfgFile();
       
    45 
       
    46 	/**
       
    47 	Structure for holding the authentication parameters read from the
       
    48 	config.txt file.  All buffer sizes are multiplied by 4 since each
       
    49 	byte needs at most 4 chars to be represented in the binary format
       
    50 	used by the config.txt (i.e. one byte represented by "\xNN").
       
    51 	*/
       
    52 	struct TAuthInfo
       
    53 		{
       
    54 		/** holds value of network challenge AUTN */
       
    55 		TBuf8<RMobilePhone::KAutnLength*4> iAUTN;
       
    56 		/** holds value of network challenge RAND */
       
    57 		TBuf8<RMobilePhone::KRandLength*4> iRAND;
       
    58 		/** holds result RES of AUTHENTICATE command when it's successfull */
       
    59 		TBuf8<RMobilePhone::KResLength*4> iRES;
       
    60 		/** holds value of session key Integrity Key */
       
    61 		TBuf8<RMobilePhone::KIkLength*4> iIK;
       
    62 		/** holds value of session key Cipher Key */
       
    63 		TBuf8<RMobilePhone::KCkLength*4> iCK;
       
    64 		/** holds value of GSM Cipher Key */
       
    65 		TBuf8<RMobilePhone::KKcLength*4> iKc;
       
    66 		/** holds value of Authentication Token when  AUTHENTICATE fails */
       
    67 		TBuf8<RMobilePhone::KAutsLength*4> iAUTS;
       
    68 		/**
       
    69 		 holds Application's ID, on which the authentication is to be
       
    70 		 carried out.  Note, there is no checking for this AID's
       
    71 		 existence, config file must simply match client's request data.
       
    72 		 */
       
    73 		TBuf8<RMobilePhone::KAIDSize*4> iAID;
       
    74 		/** holds the error code that the AUTHENTICATE request should pass/fail with */
       
    75 		TInt iAuthErr;
       
    76 		/* holds the Btid information */
       
    77 
       
    78 		};
       
    79 		
       
    80 	struct TGBAAuthInfo
       
    81 		{
       
    82 		/** holds value of network challenge AUTN */
       
    83 		TBuf8<RMobilePhone::KAutnLength> iAUTN;
       
    84 		/** holds value of network challenge RAND */
       
    85 		TBuf8<RMobilePhone::KRandLength> iRAND;
       
    86 		/**
       
    87 		 holds Application's ID, on which the authentication is to be
       
    88 		 carried out.  Note, there is no checking for this AID's
       
    89 		 existence, config file must simply match client's request data.
       
    90 		 */
       
    91 		TBuf8<RMobilePhone::KAIDSize> iAID;
       
    92 		/** holds result RES of AUTHENTICATE command when it's successfull */
       
    93 		TBuf8<RMobilePhone::KResLength> iRES;
       
    94 		/** holds value of Authentication Token when  AUTHENTICATE fails */
       
    95 		TBuf8<RMobilePhone::KAutsLength> iAUTS;
       
    96 		/** holds value of session key NAFID */
       
    97 		TBuf8<RMobilePhone::KNafIdLength> iNAFID;
       
    98 		/** holds value of session key IMPI */
       
    99 		TBuf8<RMobilePhone::KImpiLength> iIMPI;
       
   100 		/** holds value of Ks_ext_Naf key */
       
   101 		TBuf8<RMobilePhone::KKsExtNafLength> iKsExtNaf;
       
   102 		/* holds the Btid information */
       
   103 		TBuf8<RMobilePhone::KBtidLength> iBtid;
       
   104 		/* holds the keylifetime information */
       
   105 		TBuf8<RMobilePhone::KKeyLifetimeLength> iKeyLifeTime;
       
   106 		/* holds whether the other application is busy or not */
       
   107 		TBool iOtherApplnBusy;
       
   108 		/* holds whether the current application is active or not */
       
   109 		TBool iApplnActive;
       
   110 		/** holds the error code that the AUTHENTICATE request should pass/fail with */
       
   111 		TInt iAuthErr;
       
   112 		};
       
   113 
       
   114 	struct TMBMSInfo
       
   115 		{
       
   116 		/* holds the input Mikey from the Network */
       
   117 		TBuf8<RMobilePhone::KMikeyLength> iInputMikey ;  //255
       
   118 		/* holds the output Mikey containing the verification message */
       
   119 		TBuf8<RMobilePhone::KMikeyLength> iOutputMikey;  //255
       
   120 		/**holds the output parameter MBMS traffic key */
       
   121 		TBuf8<RMobilePhone::KMtkLength> iMtk;  //16
       
   122 		/** holds the output parameter random or pseudo random string used to 
       
   123 		 * protect against some offline pre computation attacks on the 
       
   124 		 * underlying security protocol. */
       
   125 		TBuf8<RMobilePhone::KSaltLength> iSaltkey;  //16
       
   126 		/** MSK is identified by its Key Domain ID and MSK ID 
       
   127 		 * holds the Keydomain ID*/		
       
   128 		TBuf8<RMobilePhone::KKeyDomainIdLength> iKeyDmn;   //3
       
   129 		/** holds the Key group part */
       
   130 		TBuf8<RMobilePhone::KKeyGroupLength> iMskIdGrp;  //2
       
   131 		/** holds the MUK ID TLV contains MUK IDr and MUK IDi */
       
   132 		TBuf8<RMobilePhone::KMukIdTlvLength> iMukIdTlv; //255
       
   133 		/** holds the IDi part of MBMS User Key */
       
   134 		TBuf8<RMobilePhone::KMukIdiLength>  iMukIdi;  //16
       
   135 		/** holds the IDr part of MBMS User Key */
       
   136 		TBuf8<RMobilePhone::KMukIdrLength>  iMukIdr; //16
       
   137 		/** holds the timestamp for MIKEY reply protection in MSK delivery. */
       
   138 		TBuf8<RMobilePhone::KTimeStampCounterLength> iMukTimestamp; //16
       
   139 		/**
       
   140 		 holds Application's ID, on which the authentication is to be
       
   141 		 carried out.  Note, there is no checking for this AID's
       
   142 		 existence, config file must simply match client's request data.
       
   143 		 */
       
   144 		TBuf8<RMobilePhone::KAIDSize> iAID;
       
   145 		/** holds value of Ks_Int_Naf key 
       
   146 		 * The length used for External NAF is being used here also*/
       
   147 		TBuf8<RMobilePhone::KKsExtNafLength> iKsIntNaf;
       
   148 		/* holds whether the current application is active or not */
       
   149 		TBool iApplnActive;
       
   150 		/** holds the error code that the AUTHENTICATE request should pass/fail with */
       
   151 		TInt iAuthErr;
       
   152 		};
       
   153 		
       
   154 private:
       
   155 	CSimPhone* iPhone;
       
   156 	TInt index;
       
   157 
       
   158 	RArray<TAuthInfo> iAuthInfoList;
       
   159 	CArrayFixFlat<TGBAAuthInfo> *iGBAAuthInfoList;
       
   160 	CArrayFixFlat<TMBMSInfo> *iMBMSInfoList;
       
   161 	};
       
   162