inc/drmserviceapiwrapper.h
changeset 0 95b198f216e5
child 18 8a03a285ab14
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Definition for Dynamically loaded wrapper for Drm Service Api
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDRMSERVICEAPIWRAPPER_H
       
    20 #define CDRMSERVICEAPIWRAPPER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "drmtypes.h"
       
    24 
       
    25 /**
       
    26  * Environment gate function
       
    27  *
       
    28  * @since S60 3.2
       
    29  * @return pointer to Drm Service API wrapper
       
    30  */
       
    31 IMPORT_C TAny* GateFunctionDrmServiceApiWrapper();
       
    32 
       
    33 class MDrmServiceApiWrapper
       
    34     {
       
    35 public:
       
    36     /**
       
    37      * Get the secure time
       
    38      *
       
    39      * @since   S60 v3.2
       
    40      * @param   aTime           Output parameter containing the 
       
    41      *                          secure time in UTC.
       
    42      * @param   aTimeZone       Time zone information including summer/winter time
       
    43      *                          in +/- 15 minutes
       
    44      * @param   aSecurityLevel  Output parameter Securiry level.
       
    45      * @return  Symbian OS error code if any.
       
    46      */
       
    47     virtual TInt GetSecureTime( TTime& aTime, 
       
    48                                 TInt& aTimeZone,
       
    49                                 DRMClock::ESecurityLevel& aSecurityLevel ) const = 0;
       
    50                         
       
    51     /**
       
    52      * Update the secure time
       
    53      *
       
    54      * Requires DRM Capability
       
    55      *
       
    56      * @since   S60 v3.2
       
    57      * @param   aTime           Input parameter containing the 
       
    58      *                          secure time in UTC.
       
    59      * @param   aTimeZone       Time zone information including 
       
    60      *                          summer/winter time
       
    61      *                          in +/- 15 minutes         
       
    62      * @return  Symbian OS error code if any.
       
    63      */
       
    64     virtual TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone ) = 0;
       
    65 
       
    66 
       
    67     /**
       
    68      * Get the device public key in Der format
       
    69      *
       
    70      * @since   S60 v3.2
       
    71      * @param   aPublicKey      Return parameter for the public key owned by
       
    72      *                          the caller
       
    73      * @return  none
       
    74      * @leave Symbian OS error code
       
    75      */
       
    76     virtual void GetDevicePublicKeyDerL( HBufC8*& aPublicKey ) = 0;
       
    77 
       
    78     /**
       
    79      * Sign the value given
       
    80      *
       
    81      * @since   S60 v3.2
       
    82      * @param   aHash           Value to be signed
       
    83      * @param   aSignature      Return parameter for the signature, owned by
       
    84      *                          the caller
       
    85      * @return  none
       
    86      * @leave Symbian OS error code
       
    87      */
       
    88     virtual void SignL( const TDesC8& aHash, HBufC8*& aSignature ) = 0;
       
    89     };
       
    90 
       
    91 
       
    92 namespace DRM 
       
    93     {
       
    94 
       
    95 // forward declaration
       
    96 class CDrmServiceApi;    
       
    97     
       
    98     
       
    99 /**
       
   100  *  Class for connecting to the WmDrmServer
       
   101  *
       
   102  *  @lib WmDrmClientWrapper
       
   103  *  @since S60 3.2
       
   104  */
       
   105 NONSHARABLE_CLASS( CDrmServiceApiWrapper ): public CBase,
       
   106                                             public MDrmServiceApiWrapper
       
   107     {
       
   108 
       
   109 public:
       
   110 
       
   111     static CDrmServiceApiWrapper* NewL();
       
   112 
       
   113     static CDrmServiceApiWrapper* NewLC();
       
   114 
       
   115     virtual ~CDrmServiceApiWrapper();
       
   116 
       
   117     /**
       
   118      * Get the secure time
       
   119      *
       
   120      * @since   S60 v3.2
       
   121      * @param   aTime           Output parameter containing the 
       
   122      *                          secure time in UTC.
       
   123      * @param   aTimeZone       Time zone information including summer/winter time
       
   124      *                          in +/- 15 minutes
       
   125      * @param   aSecurityLevel  Output parameter Securiry level.
       
   126      * @return  Symbian OS error code if any.
       
   127      */
       
   128     virtual TInt GetSecureTime( TTime& aTime, 
       
   129                                 TInt& aTimeZone,
       
   130                                 DRMClock::ESecurityLevel& aSecurityLevel ) const;
       
   131                         
       
   132     /**
       
   133      * Update the secure time
       
   134      *
       
   135      * Requires DRM Capability
       
   136      *
       
   137      * @since   S60 v3.2
       
   138      * @param   aTime           Input parameter containing the 
       
   139      *                          secure time in UTC.
       
   140      * @param   aTimeZone       Time zone information including 
       
   141      *                          summer/winter time
       
   142      *                          in +/- 15 minutes         
       
   143      * @return  Symbian OS error code if any.
       
   144      */
       
   145     virtual TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone );
       
   146 
       
   147 
       
   148     /**
       
   149      * Get the device public key in Der format
       
   150      *
       
   151      * @since   S60 v3.2
       
   152      * @param   aPublicKey      Return parameter for the public key owned by
       
   153      *                          the caller
       
   154      * @return  none
       
   155      * @leave Symbian OS error code
       
   156      */
       
   157     virtual void GetDevicePublicKeyDerL( HBufC8*& aPublicKey );
       
   158 
       
   159     /**
       
   160      * Sign the value given
       
   161      *
       
   162      * @since   S60 v3.2
       
   163      * @param   aHash           Value to be signed
       
   164      * @param   aSignature      Return parameter for the signature, owned by
       
   165      *                          the caller
       
   166      * @return  none
       
   167      * @leave Symbian OS error code
       
   168      */
       
   169     virtual void SignL( const TDesC8& aHash, HBufC8*& aSignature );
       
   170     
       
   171 protected:
       
   172 
       
   173 private:
       
   174 
       
   175     /**
       
   176     * C++ default constructor.
       
   177     */
       
   178     CDrmServiceApiWrapper();
       
   179 
       
   180     void ConstructL();
       
   181 
       
   182 
       
   183 private: // data
       
   184 
       
   185     /**
       
   186      * Download manager session
       
   187      */
       
   188     CDrmServiceApi* iServiceApi;
       
   189     
       
   190     };
       
   191     
       
   192     } // namespace DRM
       
   193     
       
   194 #endif // CDRMSERVICEAPIWRAPPER_H