wim/inc/WimCertInfo.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003 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:  WIM specific trusted settings information
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CWIMCERTINFO_H
       
    21 #define CWIMCERTINFO_H
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <cctcertinfo.h>
       
    27 #include <ct.h>
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *  This class is for sending data between WimClient and WimServer.
       
    33 *  The data is packed into this form with ExternalizeL and read with
       
    34 *  InternalizeL methods.
       
    35 *
       
    36 *  @lib WimUtil.lib
       
    37 *  @since Series60 3.0
       
    38 */
       
    39 
       
    40 class TWimCertInfoPckg
       
    41     {
       
    42     public:
       
    43 
       
    44         /**
       
    45         * Constructor.
       
    46         */
       
    47         TWimCertInfoPckg(){};
       
    48 
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~TWimCertInfoPckg(){};
       
    53           
       
    54         TBuf<KMaxCertLabelLength>   iCertLabel;
       
    55         TSHA1Hash                   iHash;
       
    56         TBool                       iTrusted;
       
    57         TCertificateFormat          iFormat;
       
    58         TCertificateOwnerType       iCertificateOwnerType;
       
    59         TInt                        iSize;
       
    60         TUint8                      iCDFRefs;
       
    61         TKeyIdentifier              iSubjectKeyId;
       
    62         TKeyIdentifier              iIssuerKeyId;
       
    63         TBuf<20>                    iTokenSerialNbr;
       
    64         TInt                        iIndex;
       
    65     };
       
    66 
       
    67 // CLASS DECLARATION
       
    68 
       
    69 /**
       
    70 *  This class contains data for trust settings of certificate.
       
    71 *  Class includes functions for creating DB, fetching, updating and 
       
    72 *  deleting trust settings.
       
    73 *
       
    74 *  @lib WimUtil.lib
       
    75 *  @since Series60 2.1
       
    76 */
       
    77 class CWimCertInfo : public CBase
       
    78     {
       
    79     public:  // Constructors and destructor
       
    80         
       
    81         /**
       
    82         * Two-phased constructor.
       
    83         * @param  aCCTCertInfo  A pointer to CCTCertInfo object. This is owned
       
    84         *         and released by CWimCertInfo  
       
    85         * @param  aHash  A hash of certificate
       
    86         * @param  aTrustedUsages  Array containing oids
       
    87         * @param  aCDFRefs Location information of a certificate
       
    88         * @return Pointer to CWimCertInfo object
       
    89         */
       
    90         IMPORT_C static CWimCertInfo* NewL( CCTCertInfo* aCCTCertInfo,
       
    91                                       const TBuf8<KSHA1HashLengthBytes> aHash,
       
    92                                       RArray<HBufC*> aTrustedUsages,
       
    93                                       TUint8 aCDFRefs );
       
    94         
       
    95         /**
       
    96         * Destructor.
       
    97         */
       
    98         virtual ~CWimCertInfo();
       
    99 
       
   100     public: // New functions
       
   101 
       
   102         /**
       
   103         * Add ExtendedKeyUsage OID to list
       
   104         * @param   aExtendedKeyUsage  A pointer to ExtendedKeyUsage OID
       
   105         * @return  TInt -Error code
       
   106         */
       
   107         IMPORT_C TInt AddExtendedKeyUsage( HBufC* aExtendedKeyUsage );
       
   108         
       
   109         /**
       
   110         * Add TrustedUsage OID to list
       
   111         * @param   aTrustedUsage  Pointer to trusted usage info
       
   112         * @return  TInt -Error code
       
   113         */
       
   114         IMPORT_C TInt AddTrustedUsage( HBufC* aTrustedUsage );
       
   115 
       
   116         /**
       
   117         * Get hash of certificate
       
   118         * @param   aHash  Hash of certificate
       
   119         * @return  void
       
   120         */
       
   121         IMPORT_C void GetCertHash( TBuf8<KSHA1HashLengthBytes>& aHash ) const;
       
   122 
       
   123         /**
       
   124         * Return pointer to CCTCertInfo
       
   125         * @return Pointer to CCTCertInfo
       
   126         */
       
   127         IMPORT_C const CCTCertInfo* CctCert() const;
       
   128 
       
   129         /**
       
   130         * Return array of TrustedUsage pointers
       
   131         * @return  TrustedUsage buffer
       
   132         */
       
   133         IMPORT_C RArray<HBufC*> TrustedUsage() const;
       
   134 
       
   135         /*
       
   136         * Return location information of this certificate
       
   137         * @return TUint8 -location
       
   138         */
       
   139         IMPORT_C TUint8 CDFRefs() const;
       
   140 
       
   141         /*
       
   142         * Set location information of this certificate
       
   143         * @param aCDFRefs -location to be set.
       
   144         * @return void
       
   145         */
       
   146         IMPORT_C void SetCDFRefs( TUint8 aCDFRefs );
       
   147 
       
   148         /**
       
   149         * Return array of ExtendedKeyUsage pointers
       
   150         * @return  ExtendedKeyUsage buffer
       
   151         */
       
   152         IMPORT_C RArray<HBufC*> ExtendedKeyUsage() const;
       
   153 
       
   154         /**
       
   155         * Externalize CWimCertInfo data to flat buffer
       
   156         * @return pointer to buffer
       
   157         */
       
   158         IMPORT_C TWimCertInfoPckg* ExternalizeL() const;
       
   159 
       
   160         /**
       
   161         * Instantiates CWimCertInfo of externalized data
       
   162         * @param flat buffer created with ExternalizeL
       
   163         * @return pointer to CWimCertInfo
       
   164         */
       
   165         IMPORT_C static CWimCertInfo* InternalizeL(
       
   166                                TWimCertInfoPckg& aExternalizedInfo );
       
   167         
       
   168     private: // Constructors
       
   169 
       
   170         /**
       
   171         * Default constructor.
       
   172         * @param  aCCTCertInfo  A pointer to CCTCertInfo object. This is owned
       
   173         *         and released by CWimCertInfo  
       
   174         * @param  aHash  A hash of certificate
       
   175         * @param  aTrustedUsages Oids of a certificate
       
   176         * @parma  aCDFRefs Location of a certificate
       
   177         */
       
   178         CWimCertInfo( CCTCertInfo* aCCTCertInfo,
       
   179                       const TBuf8<KSHA1HashLengthBytes> aHash,
       
   180                       RArray<HBufC*> aTrustedUsages,
       
   181                       TUint8  aCDFRefs );
       
   182                     
       
   183 
       
   184         /**
       
   185         * 2nd phase constructor
       
   186         */
       
   187         void ConstructL();
       
   188 
       
   189     private:    // Data
       
   190 
       
   191         // Pointer to corresponding CCTCertInfo object
       
   192         // This class owns pointed object
       
   193         CCTCertInfo*                iCCTCertInfo;
       
   194 
       
   195         //Certificate Hash
       
   196         TBuf8<KSHA1HashLengthBytes> iCertHash;
       
   197 
       
   198         // Array of pointers that point to trusted usage OIDs
       
   199         // This class owns the pointed objects
       
   200        // RArray<HBufC*> iTrustedUsage;
       
   201 
       
   202         // Array of pointer that point to extended key usage OIDs
       
   203         // This class owns the pointed objects
       
   204         RArray<HBufC*>              iExtendedKeyUsage;
       
   205 
       
   206         // Array of pointers that point to trusted usage OIDs
       
   207         // This class owns the pointed objects
       
   208         RArray<HBufC*>              iTrustedUsage;
       
   209         
       
   210         //Location information of a Certificate
       
   211         TUint8                      iCDFRefs; 
       
   212 
       
   213 
       
   214     };
       
   215 
       
   216 #endif      // CWIMCERTINFO_H
       
   217             
       
   218 // End of File