smf/smfcredentialmgr/smfcredmgrcommon/inc/smfcredmgrcommon.h
changeset 14 a469c0e6e7fb
child 18 013a02bf2bb0
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "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  * Pritam Roy Biswas, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Description:
       
    13  * This header contains common data-types between the server and client
       
    14  */
       
    15 /**
       
    16  *  @section CredentialMgr_info Implementation Information
       
    17  *  Currently there are 9 Apis exposed by the CredMgr Client. 
       
    18  *  
       
    19  *  The client is a Dll which will be used by Apps to get the CredMgr services. 
       
    20  *  The server is a seperate EXE(process). 
       
    21  *  
       
    22  *  There is also a static LIB SmfCredMgrCommon which contains data structures that are
       
    23  *  common between the server-client. 
       
    24  * 
       
    25  *  Currently data is given to server to store in a Database using @ref storeAuthData()
       
    26  *  and the other APIs are used to retrieve the data from the server-database 
       
    27  *  using SqLite queries.
       
    28  * 
       
    29  * 	So, generally to store authentication data the flow is like 
       
    30  * @msc {
       
    31  * SmfCredMgrClient, SmfCredMgrClient_p, RSmfCredMgrClientSession, SmfCredMgrServer, SmfCredMgrServerSession, CSmfCredMgrDbUser;
       
    32  * SmfCredMgrClient->SmfCredMgrClient_p  [label = "storeAuthData()"];
       
    33  * SmfCredMgrClient_p=>SmfCredMgrClient_p  [label = "ConversionsOfDatatypeAndSerializing"];
       
    34  * SmfCredMgrClient_p->RSmfCredMgrClientSession  [label = "RequestService()"];
       
    35  * RSmfCredMgrClientSession->SmfCredMgrServerSession  [label = "SendReceive()"];
       
    36  * SmfCredMgrServerSession=>SmfCredMgrServerSession  [label = "GenerateRegToken()"];
       
    37  * SmfCredMgrServerSession->CSmfCredMgrDbUser  [label = "InsertTables"];
       
    38  * SmfCredMgrClient_p<-SmfCredMgrServerSession  [label = "return = Registration Token"];
       
    39  * SmfCredMgrClient<-SmfCredMgrClient_p  [label = "return = Registration Token"];
       
    40  * };
       
    41  *
       
    42  *  The flag associated to each Plugin ID is now taken as a generic flag to entire 
       
    43  * PluginList during storing in  storeAuthData() API ,i.e if Flag = 1 the 
       
    44  * entire List of Plugins are enabled. 
       
    45  * 
       
    46  *  The NONCE and Registration Token are to be generated using SecureRandomL() library function.
       
    47  *   
       
    48  *  @Todo-  1)The validity check of the authentication data at the server side is an open item yet and is to be implemented. 
       
    49  *  This will require the signal-slot implementation at the client side to notify authentication expiry. The error handling 
       
    50  *  and also state-machine (if required) are to be implemented. 2) The process id of SmfServer needs to be checked inside 
       
    51  *  credmgr to ensure nobody else reads the keys. 
       
    52  *   
       
    53  */
       
    54 #ifndef COMMON_H_
       
    55 #define COMMON_H_
       
    56 #include <e32base.h>
       
    57 #include <e32debug.h>
       
    58 /**
       
    59  *Name of the server.
       
    60  */
       
    61 _LIT(KCredMgrServerName,"smfcredmgrserver");
       
    62 _LIT(KCredMgrServerSemaphoreName, "smfcredmgrserversemaphore" );
       
    63 _LIT(KCredMgrServerFilename, "smfcredmgrserver" );
       
    64 
       
    65 const TUint KDefaultMessageSlots = 10;
       
    66 /**
       
    67  * Version of the server
       
    68  */
       
    69 const TUint KSecureServMajorVersionNumber = 1;
       
    70 const TUint KSecureServMinorVersionNumber = 0;
       
    71 const TUint KSecureServBuildVersionNumber = 0;
       
    72 
       
    73 /**
       
    74  *Enumeration to represent Cryptographic Algorithm useds
       
    75  */
       
    76 enum SmfSignatureMethod
       
    77 	{
       
    78 	/**
       
    79 	 * Enum for no algorithm
       
    80 	 */
       
    81 	ESmfNoSigningMethod = 0,
       
    82 	/**
       
    83 	 *Enum for algorithm RSA-SHA1
       
    84 	 */
       
    85 	ESMFRSAProtocol,
       
    86 
       
    87 	/**
       
    88 	 *Enum for algorithm HMAC-SHA1
       
    89 	 */
       
    90 	ESMFHMACProtocol,
       
    91 	/**
       
    92 	 *Enum for Plain Tezt
       
    93 	 */
       
    94 	ESMFPlainText,
       
    95 	/**
       
    96 	 *Enum for SHA256
       
    97 	 */
       
    98 	ESMFSHA256Protocol
       
    99 	};
       
   100 
       
   101 /**
       
   102  * Op codes supported by the server
       
   103  */
       
   104 enum TCredentialServerRequestID
       
   105 	{
       
   106 	/**
       
   107 	 * Op code to check plugin is authorised
       
   108 	 * */
       
   109 	ECheckPluginAuthentication = 1,
       
   110 
       
   111 	/**
       
   112 	 * Op code to store entire set of data while authentication
       
   113 	 * */
       
   114 	EStoreAuthData,
       
   115 
       
   116 	/**
       
   117 	 * Op code to send OAuth key set i.e SmfAuthParams
       
   118 	 * */
       
   119 	ESendAuthDataSet,
       
   120 
       
   121 	/**
       
   122 	 * Op code to send authenticated plugin list
       
   123 	 * */
       
   124 	ESendPluginIDList,
       
   125 
       
   126 	/**
       
   127 	 * Op code to send URL list.
       
   128 	 */
       
   129 	ESendURLList,
       
   130 
       
   131 	/**
       
   132 	 * Op code to update plugin list.
       
   133 	 */
       
   134 	EUpdatePluginIDList,
       
   135 
       
   136 	/**
       
   137 	 * Op code to store RSA keys.
       
   138 	 */
       
   139 	ESmfStoreRSAKey,
       
   140 	/**
       
   141 	 * Op code to sign message using RSA algo.
       
   142 	 */
       
   143 	ESmfRSASignMessage,
       
   144 	/**
       
   145 	 * Op code to sign using HAMC-SHA1 algo.
       
   146 	 */
       
   147 	ESmfHMACSHA1SignMessage,
       
   148 	/**
       
   149 	 * Op code to delete RSA keys.
       
   150 	 */
       
   151 	ESmfDeleteKeys
       
   152 	};
       
   153 
       
   154 #endif /* COMMON_H_ */