wim/WimClient/inc/WimCertMgmt.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 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 "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:  Certificate & key -management class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WIMCERTMGMT_H
       
    20 #define WIMCERTMGMT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "WimClient.h"
       
    24 #include "WimCertTClassWrappers.h"
       
    25 #include "JavaUtils.h"
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 *  RWimCertMgmt 
       
    32 *  This class handle certificate handling and KeyInformation handling
       
    33 *  related traffic between client and server.
       
    34 *  @lib WimClient
       
    35 *  @since Series 60 2.1
       
    36 */
       
    37 class RWimCertMgmt: public RWimClient
       
    38     {
       
    39     public:
       
    40 
       
    41         /**
       
    42         * A Static method to get the client Session
       
    43         * @Return RWimCertMgmt*
       
    44         */  
       
    45         static RWimCertMgmt* ClientSessionL();
       
    46 
       
    47         /**
       
    48         * Destructor.
       
    49         * Allocated memory is released.
       
    50         */  
       
    51         virtual ~RWimCertMgmt();
       
    52         
       
    53         /**
       
    54         * Returns the count of certificates
       
    55         * @param aType  -The type of certificates to be counted.
       
    56         * @return TUint8 -The count of certificates
       
    57         */
       
    58         TUint8 CertCount( TWimEntryType aType );
       
    59 
       
    60         /**
       
    61         * Returns certificate list on the WIM.
       
    62         * @param aCertAddrLst - to hold references to certificates
       
    63         * @param aCertInfoArr -address of the certlist address
       
    64         * @param aCount       -the count of certificates
       
    65         * @param aCertEntryType -What type of certificates is wanted:
       
    66         *                ECrEntryTypeAll, ECrEntryTypeCA or ECrEntryTypePersonal  
       
    67         * @param aStatus -Caller's status 
       
    68         * @return void
       
    69         */  
       
    70         void  CertRefLst( TCertificateAddressList aCertAddrLst,
       
    71                           TWimCertInfo* aCertInfoArr, 
       
    72                           TUint8 aCount, 
       
    73                           TWimEntryType aCertEntryType, 
       
    74                           TRequestStatus& aStatus );
       
    75       
       
    76         /**
       
    77         * Returns certificate list on the WIM.
       
    78         * @param aCertAddrLst - to hold references to certificates
       
    79         * @param aCertInfoArr -address of the certlist address
       
    80         * @param aCount       -the count of certificates
       
    81         * @param aCertEntryType -What type of certificates is wanted:
       
    82         *                ECrEntryTypeAll, ECrEntryTypeCA or ECrEntryTypePersonal  
       
    83         * @return TInt -Errorcode from server.
       
    84         */          
       
    85         TInt CertRefLst( TCertificateAddressList aCertAddrLst, 
       
    86                          TWimCertInfo* aCertInfoArr, 
       
    87                          TUint8 aCount, 
       
    88                          TWimEntryType aCertEntryType );
       
    89         /**
       
    90         * Stores the certificate to WIM.
       
    91         * @param aCertificate- certificate
       
    92         * @param aParams - TWimCertAddParameters params to the certificate
       
    93         * @param aLocation  -Location where we want to store. In this case:
       
    94                             EWimCertLocationWIMCard
       
    95         * @return void
       
    96         */
       
    97         void StoreCertificateL( const TDes8& aCertificate, 
       
    98                                TWimCertAddParameters& aParams, 
       
    99                                TWimCertLocation aLocation,
       
   100                                TRequestStatus& aStatus );
       
   101         
       
   102         /**
       
   103         * Removes a certificate from WIM.
       
   104         * @param aWimCertRemoveAddr - reference to the certificate
       
   105         * @param aStatus    -Status from caller
       
   106         * @return void
       
   107         */  
       
   108         void RemoveL( TWimCertRemoveAddr aWimCertRemoveAddr,
       
   109                       TRequestStatus& aStatus );
       
   110 
       
   111         /**
       
   112         * Returns certificate details.
       
   113         * @param aCertAddr - reference to the certificate
       
   114         * @param aWimCertDetails -Preallocated structure to hold 
       
   115         *                        the certificate info
       
   116         * @param aStatus    -Caller's status
       
   117         * @return void
       
   118         */  
       
   119         void CertDetailsL( const TCertificateAddress aCertAddr, 
       
   120                            TWimCertDetails& aWimCertDetails,
       
   121                            TRequestStatus& aStatus );
       
   122 
       
   123         /**
       
   124         * Gets certificate extra information from one certificate
       
   125         * @param aKeyId - identifies needed certificate
       
   126         * @param aCertExtrasInfo -Preallocated structure to hold 
       
   127         *                        the certificate extra info
       
   128         * @param aUsage     -Identifies the usage of certificate, User or CA
       
   129         * @param aStatus    -Caller's status
       
   130         * @return void
       
   131         */  
       
   132         void GetCertExtrasL(  const TPtr8* aKeyId, 
       
   133                               TCertExtrasInfo& aCertExtrasInfo,
       
   134                               TUint aUsage,
       
   135                               TRequestStatus& aStatus );
       
   136 
       
   137         /** 
       
   138         * Returns KeyList from the WIM.
       
   139         * @param aKeyList   -KeyReferences are listed to this
       
   140         * @param aKeyCount  -The number of keys is put to this
       
   141         * @param aStatus    -Caller's status
       
   142         */
       
   143         void KeyList( TDes8& aKeyList,
       
   144                       TDes8& aKeyCount, 
       
   145                       TRequestStatus& aStatus );
       
   146 
       
   147         /** 
       
   148         * Gets keyInfo for single key.
       
   149         * @param aKeyReference  -Unique identifier for key.
       
   150         * @param aKeyInfo   -Struct for other key information.
       
   151         */
       
   152         TInt GetKeyInfo( const TInt32 aKeyReference,
       
   153                          TKeyInfo& aKeyInfo );
       
   154 
       
   155         /** 
       
   156         * Signs some data
       
   157         * @param aSignParameters -holds data for signing operation
       
   158         * @param aStatus         -Caller's status
       
   159         */
       
   160         void SignL( TKeySignParameters& aSignParameters, 
       
   161                    TRequestStatus& aStatus );
       
   162 
       
   163         /** 
       
   164         * Export public key
       
   165         * @param aPublicKeyParams -struct which holds publickeyPtr and Key 
       
   166         *                          identifier.
       
   167         *                          pointer.
       
   168         * @param aStatus        -Caller's Status.
       
   169         */
       
   170         void ExportPublicKeyL( TExportPublicKey& aPublicKeyParams, 
       
   171                               TRequestStatus& aStatus );
       
   172  
       
   173 
       
   174         /**
       
   175         * Retrieves data for OMA Provisioning support. Data can be data size,
       
   176         * type or the actual binary data.
       
   177         * @param aOmaProvStruct -Struct to hold OMA Provisioning data.
       
   178         * @param aStatus        -Caller's status
       
   179         * @param aOpCode        -Code of operation ( EGetOMAFileSize or 
       
   180         *                                            EGetOMAFile
       
   181         *
       
   182         */
       
   183         void RetrieveOmaDataL( TOmaProv& aOmaProvStruct,
       
   184                                TRequestStatus& aStatus,
       
   185                                const TWimServRqst aOpCode );
       
   186        
       
   187        /**
       
   188         * Retrieves ACIF data.
       
   189         *
       
   190         * @since S60 3.2
       
   191         * @param aJavaProvStruct Struct to hold Java data.
       
   192         * @param aStatus Caller's status
       
   193         * @param aOpCode Code of operation 
       
   194         * @return                                            
       
   195         *
       
   196         */
       
   197         void RetrieveACIFDataL( TJavaProv& aJavaProvStruct,
       
   198                                TRequestStatus& aStatus,
       
   199                                const TWimServRqst aOpCode );
       
   200         
       
   201         /**
       
   202         * Retrieves ACF data.
       
   203         *
       
   204         * @since S60 3.2
       
   205         * @param aJavaProvStruct Struct to hold Java data.
       
   206         * @param aStatus Caller's status
       
   207         * @param aOpCode Code of operation 
       
   208         * @return                                           
       
   209         *
       
   210         */                        
       
   211         void RetrieveACFDataL( TJavaProv& aJavaProvStruct,
       
   212                                TRequestStatus& aStatus,
       
   213                                const TWimServRqst aOpCode );   
       
   214         
       
   215         /**
       
   216         * Retrieves Authtication object data.
       
   217         *
       
   218         * @since S60 3.2
       
   219         * @param aAuthIdList 
       
   220         * @param aAuthObjsInfoList 
       
   221         * @param aStatus Caller's status
       
   222         * @param aOpCode Code of operation 
       
   223         * @return                                           
       
   224         *
       
   225         */                       
       
   226         void RetrieveAuthObjsInfoL(const RArray<TInt>& aAuthIdList,
       
   227                               RArray<TJavaPINParams>& aAuthObjsInfoList,
       
   228                               TRequestStatus& aStatus,
       
   229                               const TWimServRqst aOpCode );  
       
   230         
       
   231         
       
   232         /**
       
   233         * Retrieves Label and Path.
       
   234         *
       
   235         * @since S60 3.2
       
   236         * @param aLabel
       
   237         * @param aPath 
       
   238         * @param aStatus Caller's status
       
   239         * @param aOpCode Code of operation 
       
   240         * @return                                           
       
   241         *
       
   242         */                         
       
   243         void RetrieveLabelAndPathL( TDes8& aLabel,
       
   244         	                        TDes8& aPath, 
       
   245                                     TRequestStatus& aStatus,
       
   246                                     const TWimServRqst aOpCode );                      
       
   247                                                                                     
       
   248         /** 
       
   249         * Deallocates memory from iPckgCertDetails.
       
   250         * @return void
       
   251         */
       
   252         void DeallocWimCertPckgBuf();
       
   253 
       
   254         /** 
       
   255         * Deallocates memory from iPckgAddCerts.
       
   256         * @return void
       
   257         */
       
   258         void DeallocCertAddParametersPckgBuf();
       
   259 
       
   260         /** 
       
   261         * Deallocates memory from iPckgRemoveCert.
       
   262         * @return void
       
   263         */
       
   264         void DeallocRemoveCertPckgBuf();
       
   265 
       
   266         /**
       
   267         * Deallocates memory from iPckgGetExtrasAllocated.
       
   268         * @return void
       
   269         */
       
   270         void DeallocGetExtrasPckgBuf();
       
   271 
       
   272         /**
       
   273         * Deallocates memory from iPckgKeySignParameters.
       
   274         * @return void
       
   275         */
       
   276         void DeallocKeySignPckgBuf();
       
   277 
       
   278         /**
       
   279         * Deallocates memory from iPckgBufExportPublicKey.
       
   280         * @return void
       
   281         */
       
   282         void DeallocExportPublicKeyPckgBuf();
       
   283 
       
   284         /** 
       
   285         * Deallocates memory from iPckgBufOmaProv
       
   286         * @return void
       
   287         */
       
   288         void DeallocOmaDataPckgBuf();
       
   289         
       
   290         /** 
       
   291         * Deallocates memory from iPckgBufJavaProv
       
   292         * @return void
       
   293         */
       
   294         void DeallocJavaDataPckgBuf();
       
   295 
       
   296         /** 
       
   297         * Return CWimCertPckgBuf<TCertExtrasInfo> pointer to caller
       
   298         * @return CWimCertPckgBuf<TCertExtrasInfo>* 
       
   299         */
       
   300         CWimCertPckgBuf<TCertExtrasInfo>* CertExtrasPckgBuf();
       
   301 
       
   302         /** 
       
   303         * Return CWimCertPckgBuf<TOmaProv> pointer to caller
       
   304         * @return CWimCertPckgBuf<TOmaProv>* 
       
   305         */
       
   306         CWimCertPckgBuf<TOmaProv>* TOmaProvPckgBuf();
       
   307         
       
   308         /** 
       
   309         * Return CWimCertPckgBuf<TJavaProv> pointer to caller
       
   310         * @return CWimCertPckgBuf<TJavaProv>* 
       
   311         */
       
   312         CWimCertPckgBuf<TJavaProv>* TJavaProvPckgBuf();
       
   313         
       
   314     private:
       
   315         
       
   316         /**
       
   317         * Constructor 
       
   318         */
       
   319         RWimCertMgmt();
       
   320 
       
   321         /** 
       
   322         * Copy constructor
       
   323         * @param aSource -Reference to class object.
       
   324         */
       
   325         RWimCertMgmt( const RWimCertMgmt& aSource );
       
   326 
       
   327         /** 
       
   328         * Assignment operator
       
   329         * @param aParam -Reference to class object.
       
   330         */
       
   331         RWimCertMgmt& operator = ( const RWimCertMgmt& aParam );
       
   332 
       
   333     private:
       
   334       
       
   335         //Used to point data when listing every certificate from WIM.
       
   336         TPtr8                                   iCertLst;
       
   337 
       
   338         //Used to point data when listing every certificate from WIM.
       
   339         TPtr8                                   iCertInfoLst;
       
   340 
       
   341         //PckgBuffer wrapper which is used when retrieving certificate.Owned.
       
   342         CWimCertPckgBuf<TWimCertDetails>*       iPckgBufCertDetails;
       
   343 
       
   344         //PckgBuffer wrapper which is used when adding a certificate.Owned.
       
   345         CWimCertPckgBuf<TWimCertAddParameters>* iPckgBufAddCerts;
       
   346 
       
   347         //PckgBuffer wrapper which is used when removing a certificate.Owned.
       
   348         CWimCertPckgBuf<TWimCertRemoveAddr>*    iPckgBufRemoveCert;
       
   349 
       
   350         //PckgBuffer wrapper which is used when getting certificate extra 
       
   351         //information from server.Owned.
       
   352         CWimCertPckgBuf<TCertExtrasInfo>*       iPckgBufGetExtras;
       
   353 
       
   354         //Pckgbuffer wrapper which is used when signing data.Owned.
       
   355         CWimCertPckgBuf<TKeySignParameters>*    iPckgBufKeySignParameters;
       
   356 
       
   357         //Pckgbuffer wrapper which is used when exporting public key.Owned.
       
   358         CWimCertPckgBuf<TExportPublicKey>*      iPckgBufExportPublicKey;
       
   359 
       
   360         //Pckgbuffer wrapper which is used when getting data for 
       
   361         //OMA Provisioning.Owned.
       
   362         CWimCertPckgBuf<TOmaProv>*              iPckgBufOmaProv;
       
   363         
       
   364         //Pckgbuffer wrapper which is used when getting data for 
       
   365         //Java Provisioning.Owned.
       
   366         CWimCertPckgBuf<TJavaProv>*             iPckgBufJavaProv;
       
   367         
       
   368         //Flag to indicate whether certificate details package is allocated or 
       
   369         //not.
       
   370         TBool                                   iPckgBufCertDetailsAllocated;
       
   371         
       
   372         //Flag to indicate whether add certificate package is allocated or not.
       
   373         TBool                                   iPckgBufAddCertsAllocated;
       
   374 
       
   375         //Flag to indicate whether remove certificate package is allocated or 
       
   376         //not.
       
   377         TBool                                   iPckgBufRemoveCertAllocated;
       
   378 
       
   379         //Flag to indicate whether extra information package is allocated or 
       
   380         //not
       
   381         TBool                                   iPckgBufGetExtrasAllocated;
       
   382 
       
   383         //Flag to indicate whether signing package is allocated or not.
       
   384         TBool                                   iPckgBufKeySignAllocated;
       
   385     
       
   386         //Flag to indicate whether export public key package is allocated or 
       
   387         //not
       
   388         TBool                                   iPckgBufExportPublicKeyAllocated;
       
   389 
       
   390         //Flag to indicate whether OMA Provisioning package is allocated or 
       
   391         //not
       
   392         TBool                                   iPckgBufOmaProvAllocated;
       
   393         
       
   394         //Flag to indicate whether Java Provisioning package is allocated or 
       
   395         //not
       
   396         TBool                                   iPckgBufJavaProvAllocated;
       
   397         
       
   398         TPtr8*                                  iAuthObjsInfoLstPtr;
       
   399 	    
       
   400 	    TPtrC8*                                 iAuthIdLstPtr;
       
   401 
       
   402     };
       
   403 
       
   404 #endif //WIMCERTMGMT_H
       
   405 
       
   406 
       
   407 
       
   408 
       
   409 
       
   410 
       
   411 
       
   412 
       
   413 
       
   414 
       
   415 
       
   416 
       
   417 
       
   418 
       
   419 
       
   420 
       
   421 
       
   422 
       
   423 
       
   424 
       
   425 
       
   426 
       
   427 
       
   428 
       
   429 
       
   430 
       
   431 
       
   432 
       
   433 
       
   434 
       
   435 
       
   436 
       
   437 
       
   438 
       
   439 
       
   440 
       
   441 
       
   442 
       
   443 
       
   444 
       
   445 
       
   446