omadrm/drmengine/server/src/DRMRightsData.cpp
changeset 23 493788a4a8a4
parent 0 95b198f216e5
child 84 b09186059647
equal deleted inserted replaced
5:79d62d1d7957 23:493788a4a8a4
    22 #include <s32std.h>
    22 #include <s32std.h>
    23 #include <caf/caf.h>
    23 #include <caf/caf.h>
    24 
    24 
    25 #include "DRMPointerArray.h"
    25 #include "DRMPointerArray.h"
    26 #include "DRMCommonData.h"
    26 #include "DRMCommonData.h"
    27 #include "DRMPermission.h"
    27 #include "DrmPermission.h"
    28 #include "DRMRightsData.h"
    28 #include "DRMRightsData.h"
    29 
    29 
    30 // EXTERNAL DATA STRUCTURES
    30 // EXTERNAL DATA STRUCTURES
    31 
    31 
    32 // EXTERNAL FUNCTION PROTOTYPES  
    32 // EXTERNAL FUNCTION PROTOTYPES
    33 
    33 
    34 // CONSTANTS
    34 // CONSTANTS
    35 const TInt KEncryptionKeySize = 16;
    35 const TInt KEncryptionKeySize = 16;
    36 
    36 
    37 // MACROS
    37 // MACROS
    42 
    42 
    43 // LOCAL FUNCTION PROTOTYPES
    43 // LOCAL FUNCTION PROTOTYPES
    44 
    44 
    45 // FORWARD DECLARATIONS
    45 // FORWARD DECLARATIONS
    46 
    46 
    47 class TPermData 
    47 class TPermData
    48     {
    48     {
    49     public: // Constructor
    49     public: // Constructor
    50     TPermData( HBufC8* aParentId, const TInt aIndex, TBool aIsValid ) :
    50     TPermData( HBufC8* aParentId, const TInt aIndex, TBool aIsValid ) :
    51         iParentId( aParentId ),
    51         iParentId( aParentId ),
    52         iIndex( aIndex ),
    52         iIndex( aIndex ),
    53         iIsValid( aIsValid ) { };
    53         iIsValid( aIsValid ) { };
    54     
    54 
    55     public: // Member variables    
    55     public: // Member variables
    56     HBufC8* iParentId; 
    56     HBufC8* iParentId;
    57     TInt iIndex;
    57     TInt iIndex;
    58     TBool iIsValid;
    58     TBool iIsValid;
    59     };
    59     };
    60 
    60 
    61 
    61 
    65 // -----------------------------------------------------------------------------
    65 // -----------------------------------------------------------------------------
    66 // CDRMRightsData::NewLC
    66 // CDRMRightsData::NewLC
    67 // -----------------------------------------------------------------------------
    67 // -----------------------------------------------------------------------------
    68 //
    68 //
    69 CDRMRightsData* CDRMRightsData::NewLC( CDRMCommonData* aData,
    69 CDRMRightsData* CDRMRightsData::NewLC( CDRMCommonData* aData,
    70                                        const TDesC8& aKey, 
    70                                        const TDesC8& aKey,
    71                                        const TFileName& aRightsFile,
    71                                        const TFileName& aRightsFile,
    72                                        RFs& aFileServer )
    72                                        RFs& aFileServer )
    73     {
    73     {
    74     CDRMRightsData* self = new( ELeave ) CDRMRightsData( aData, aFileServer );
    74     CDRMRightsData* self = new( ELeave ) CDRMRightsData( aData, aFileServer );
    75     CleanupStack::PushL( self );
    75     CleanupStack::PushL( self );
    76     self->ConstructL( aRightsFile, aKey );
    76     self->ConstructL( aRightsFile, aKey );
    77 
    77 
    78     return self;    
    78     return self;
    79     };
    79     };
    80     
    80 
    81 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
    82 // CDRMRightsData::NewL
    82 // CDRMRightsData::NewL
    83 // -----------------------------------------------------------------------------
    83 // -----------------------------------------------------------------------------
    84 //
    84 //
    85 CDRMRightsData* CDRMRightsData::NewL( CDRMCommonData* aData, 
    85 CDRMRightsData* CDRMRightsData::NewL( CDRMCommonData* aData,
    86                                       const TDesC8& aKey,
    86                                       const TDesC8& aKey,
    87                                       const TFileName& aRightsFile,
    87                                       const TFileName& aRightsFile,
    88                                       RFs& aFileServer )
    88                                       RFs& aFileServer )
    89     {
    89     {
    90     CDRMRightsData* self = NewLC( aData, aKey, aRightsFile, aFileServer );
    90     CDRMRightsData* self = NewLC( aData, aKey, aRightsFile, aFileServer );
    91     CleanupStack::Pop();	
    91     CleanupStack::Pop();
    92     
    92 
    93     return self;    
    93     return self;
    94     };
    94     };
    95                                  
    95 
    96 // -----------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
    97 // CDRMRightsData::OpenLC
    97 // CDRMRightsData::OpenLC
    98 // -----------------------------------------------------------------------------
    98 // -----------------------------------------------------------------------------
    99 //
    99 //
   100 CDRMRightsData* CDRMRightsData::OpenLC( const TFileName& aRightsFile,
   100 CDRMRightsData* CDRMRightsData::OpenLC( const TFileName& aRightsFile,
   101                                         RFs& aFileServer )
   101                                         RFs& aFileServer )
   102     {
   102     {
   103     CDRMCommonData* common = CDRMCommonData::NewL();
   103     CDRMCommonData* common = CDRMCommonData::NewL();
   104 
   104 
   105     CDRMRightsData* self = new( ELeave ) CDRMRightsData( common, aFileServer );
   105     CDRMRightsData* self = new( ELeave ) CDRMRightsData( common, aFileServer );
   106     CleanupStack::PushL( self );    
   106     CleanupStack::PushL( self );
   107     self->ConstructL( aRightsFile );
   107     self->ConstructL( aRightsFile );
   108     
   108 
   109     return self;
   109     return self;
   110     };    
   110     };
   111     
   111 
   112 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
   113 // CDRMRightsData::OpenL
   113 // CDRMRightsData::OpenL
   114 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   115 //
   115 //
   116 CDRMRightsData* CDRMRightsData::OpenL( const TFileName& aRightsFile,
   116 CDRMRightsData* CDRMRightsData::OpenL( const TFileName& aRightsFile,
   117                                        RFs& aFileServer )
   117                                        RFs& aFileServer )
   118     {
   118     {
   119     CDRMRightsData* self = OpenLC( aRightsFile, aFileServer );
   119     CDRMRightsData* self = OpenLC( aRightsFile, aFileServer );
   120     CleanupStack::Pop();
   120     CleanupStack::Pop();
   121     
   121 
   122     return self;    
   122     return self;
   123     };    
   123     };
   124     
   124 
   125 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   126 // Destructor
   126 // Destructor
   127 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
   128 // 
   128 //
   129 CDRMRightsData::~CDRMRightsData()
   129 CDRMRightsData::~CDRMRightsData()
   130     {
   130     {
   131     // Permanent File Store
   131     // Permanent File Store
   132     if( iStore )
   132     if( iStore )
   133         {;
   133         {;
   134         delete iStore;
   134         delete iStore;
   135         iStore = NULL;
   135         iStore = NULL;
   136         }
   136         }
   137         
   137 
   138     // index array    
   138     // index array
   139     iArray.Close();
   139     iArray.Close();
   140     
   140 
   141     // Common Data
   141     // Common Data
   142     if( iData )
   142     if( iData )
   143         {
   143         {
   144         delete iData;
   144         delete iData;
   145         iData = NULL;
   145         iData = NULL;
   146         }
   146         }
   147     }; 
   147     };
   148 
   148 
   149 
   149 
   150 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   151 // CDRMRightsData::GetCommonDataL
   151 // CDRMRightsData::GetCommonDataL
   152 // -----------------------------------------------------------------------------
   152 // -----------------------------------------------------------------------------
   167     // If not data is given, that is an error
   167     // If not data is given, that is an error
   168     if( !aData )
   168     if( !aData )
   169         {
   169         {
   170         User::Leave( KErrArgument );
   170         User::Leave( KErrArgument );
   171         }
   171         }
   172            
   172 
   173     // Open the stream 
   173     // Open the stream
   174     stream.ReplaceLC( *iStore, iCommonId );
   174     stream.ReplaceLC( *iStore, iCommonId );
   175     
   175 
   176     // Delete the old data if it's around
   176     // Delete the old data if it's around
   177     // if the old data has been modified, write it as such
   177     // if the old data has been modified, write it as such
   178     if( iData != aData )
   178     if( iData != aData )
   179     	{
   179         {
   180         if( iData )
   180         if( iData )
   181         	{
   181             {
   182         	delete iData;
   182             delete iData;
   183         	iData = NULL;        	
   183             iData = NULL;
   184         	}
   184             }
   185     	iData = aData;        
   185         iData = aData;
   186         }
   186         }
   187     
   187 
   188     // Write the data to the stream
   188     // Write the data to the stream
   189     iData->ExternalizeL( stream );
   189     iData->ExternalizeL( stream );
   190     
   190 
   191     // commit the stream
   191     // commit the stream
   192     stream.CommitL();
   192     stream.CommitL();
   193     
   193 
   194     // commit the store
   194     // commit the store
   195     iStore->CommitL();
   195     iStore->CommitL();
   196     
   196 
   197     // pop the stream
   197     // pop the stream
   198     CleanupStack::PopAndDestroy();
   198     CleanupStack::PopAndDestroy();
   199     };        
   199     };
   200     
   200 
   201 // -----------------------------------------------------------------------------
   201 // -----------------------------------------------------------------------------
   202 // CDRMRightsData::StoreNewPermissionL
   202 // CDRMRightsData::StoreNewPermissionL
   203 // -----------------------------------------------------------------------------
   203 // -----------------------------------------------------------------------------
   204 //
   204 //
   205 void CDRMRightsData::StoreNewPermissionL( CDRMPermission& aPermission,
   205 void CDRMRightsData::StoreNewPermissionL( CDRMPermission& aPermission,
   207     {
   207     {
   208     TStreamId sid;
   208     TStreamId sid;
   209     TStreamId rootId;
   209     TStreamId rootId;
   210     RStoreWriteStream stream;
   210     RStoreWriteStream stream;
   211     RStoreWriteStream rootStream;
   211     RStoreWriteStream rootStream;
   212        
   212 
   213     // Create a new stream to the store:
   213     // Create a new stream to the store:
   214     sid = stream.CreateLC( *iStore );
   214     sid = stream.CreateLC( *iStore );
   215     
   215 
   216     aPermission.iUniqueID = sid.Value();   
   216     aPermission.iUniqueID = sid.Value();
   217     aStream = sid.Value();
   217     aStream = sid.Value();
   218     
   218 
   219     // Externalize the permission data
   219     // Externalize the permission data
   220     aPermission.ExternalizeL( stream );
   220     aPermission.ExternalizeL( stream );
   221     stream.CommitL();
   221     stream.CommitL();
   222         
   222 
   223     // add the id to the array
   223     // add the id to the array
   224     iArray.InsertInUnsignedKeyOrder( aStream );
   224     iArray.InsertInUnsignedKeyOrder( aStream );
   225 
   225 
   226     // Get the stream id of the root
   226     // Get the stream id of the root
   227     rootId = iStore->Root();
   227     rootId = iStore->Root();
   228     
   228 
   229     // Open the root stream
   229     // Open the root stream
   230     rootStream.ReplaceLC( *iStore, rootId );
   230     rootStream.ReplaceLC( *iStore, rootId );
   231         
   231 
   232     // Store the changed index
   232     // Store the changed index
   233     StoreIndexL( rootStream );    
   233     StoreIndexL( rootStream );
   234     rootStream.CommitL();
   234     rootStream.CommitL();
   235 
   235 
   236     // Commit the store
   236     // Commit the store
   237     iStore->CommitL();
   237     iStore->CommitL();
   238     
   238 
   239     CleanupStack::PopAndDestroy();  // root stream
   239     CleanupStack::PopAndDestroy();  // root stream
   240     CleanupStack::PopAndDestroy();  // stream
   240     CleanupStack::PopAndDestroy();  // stream
   241     
   241 
   242     iStore->CompactL();
   242     iStore->CompactL();
   243     iStore->CommitL();
   243     iStore->CommitL();
   244     };    
   244     };
   245     
   245 
   246 // -----------------------------------------------------------------------------
   246 // -----------------------------------------------------------------------------
   247 // CDRMRightsData::UpdatePermissionL
   247 // CDRMRightsData::UpdatePermissionL
   248 // -----------------------------------------------------------------------------
   248 // -----------------------------------------------------------------------------
   249 //
   249 //
   250 void CDRMRightsData::UpdatePermissionL( const CDRMPermission& aPermission )
   250 void CDRMRightsData::UpdatePermissionL( const CDRMPermission& aPermission )
   251     {
   251     {
   252     TStreamId sid( aPermission.iUniqueID );
   252     TStreamId sid( aPermission.iUniqueID );
   253     RStoreWriteStream stream;
   253     RStoreWriteStream stream;
   254     TInt index = 0;
   254     TInt index = 0;
   255     
   255 
   256     // get the id from the array if it doesn't exist, error
   256     // get the id from the array if it doesn't exist, error
   257     index = iArray.FindInUnsignedKeyOrder( aPermission.iUniqueID );
   257     index = iArray.FindInUnsignedKeyOrder( aPermission.iUniqueID );
   258     
   258 
   259     if( index == KErrNotFound )
   259     if( index == KErrNotFound )
   260         {
   260         {
   261         User::Leave( KErrCANoPermission );
   261         User::Leave( KErrCANoPermission );
   262         }
   262         }
   263     
   263 
   264     // Replace the existing stream
   264     // Replace the existing stream
   265     stream.ReplaceLC( *iStore, sid );
   265     stream.ReplaceLC( *iStore, sid );
   266     
   266 
   267     // Externalize the permission data
   267     // Externalize the permission data
   268     aPermission.ExternalizeL( stream );
   268     aPermission.ExternalizeL( stream );
   269     
   269 
   270     // Required by the ReplaceLC
   270     // Required by the ReplaceLC
   271     stream.CommitL();
   271     stream.CommitL();
   272 
   272 
   273     // Commit the store    
   273     // Commit the store
   274     iStore->CommitL();
   274     iStore->CommitL();
   275     
   275 
   276     CleanupStack::PopAndDestroy();
   276     CleanupStack::PopAndDestroy();
   277     };
   277     };
   278     
   278 
   279 // -----------------------------------------------------------------------------
   279 // -----------------------------------------------------------------------------
   280 // CDRMRightsData::FetchPermissionL
   280 // CDRMRightsData::FetchPermissionL
   281 // -----------------------------------------------------------------------------
   281 // -----------------------------------------------------------------------------
   282 //
   282 //
   283 void CDRMRightsData::FetchPermissionL( CDRMPermission& aPermission,
   283 void CDRMRightsData::FetchPermissionL( CDRMPermission& aPermission,
   284                                        const TDRMUniqueID& aStream ) const
   284                                        const TDRMUniqueID& aStream ) const
   285     {
   285     {
   286     TStreamId sid( aStream );    
   286     TStreamId sid( aStream );
   287     RStoreReadStream stream;
   287     RStoreReadStream stream;
   288     TInt index = 0;
   288     TInt index = 0;
   289 
   289 
   290     // get the id from the array if it doesn't exist, error
   290     // get the id from the array if it doesn't exist, error
   291     index = iArray.FindInUnsignedKeyOrder( aStream );
   291     index = iArray.FindInUnsignedKeyOrder( aStream );
   292     
   292 
   293     if( index == KErrNotFound )
   293     if( index == KErrNotFound )
   294         {
   294         {
   295         User::Leave( KErrCANoPermission );
   295         User::Leave( KErrCANoPermission );
   296         }
   296         }
   297     
   297 
   298     // Open the root stream
   298     // Open the root stream
   299     stream.OpenLC( *iStore, sid );
   299     stream.OpenLC( *iStore, sid );
   300 
   300 
   301     // Read the common id
   301     // Read the common id
   302     aPermission.InternalizeL( stream );
   302     aPermission.InternalizeL( stream );
   303     
   303 
   304     // Close the stream
   304     // Close the stream
   305     CleanupStack::PopAndDestroy();        
   305     CleanupStack::PopAndDestroy();
   306     };
   306     };
   307     
   307 
   308 // -----------------------------------------------------------------------------
   308 // -----------------------------------------------------------------------------
   309 // CDRMRightsData::DeletePermissionL
   309 // CDRMRightsData::DeletePermissionL
   310 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   311 //
   311 //
   312 void CDRMRightsData::DeletePermissionL( const TDRMUniqueID& aStream )
   312 void CDRMRightsData::DeletePermissionL( const TDRMUniqueID& aStream )
   313     {
   313     {
   314     TStreamId sid( aStream );
   314     TStreamId sid( aStream );
   315     TStreamId rootId;
   315     TStreamId rootId;
   316     TInt index = 0;
   316     TInt index = 0;
   317     RStoreWriteStream rootStream;
   317     RStoreWriteStream rootStream;
   318         
   318 
   319     // get the id from the array if it doesn't exist, error
   319     // get the id from the array if it doesn't exist, error
   320     index = iArray.FindInUnsignedKeyOrder( aStream );
   320     index = iArray.FindInUnsignedKeyOrder( aStream );
   321     
   321 
   322     if( index == KErrNotFound )
   322     if( index == KErrNotFound )
   323         {
   323         {
   324         User::Leave( KErrCANoPermission );
   324         User::Leave( KErrCANoPermission );
   325         }
   325         }
   326 
   326 
   327     // Delete the stream from the store
   327     // Delete the stream from the store
   328     iStore->DeleteL( sid );
   328     iStore->DeleteL( sid );
   329             
   329 
   330     iArray.Remove( index );       
   330     iArray.Remove( index );
   331     
   331 
   332     
   332 
   333     // Get the stream id of the root
   333     // Get the stream id of the root
   334     rootId = iStore->Root();
   334     rootId = iStore->Root();
   335     
   335 
   336     // Open the root stream
   336     // Open the root stream
   337     rootStream.ReplaceLC( *iStore, rootId );
   337     rootStream.ReplaceLC( *iStore, rootId );
   338         
   338 
   339     // Store the changed index
   339     // Store the changed index
   340     StoreIndexL( rootStream );    
   340     StoreIndexL( rootStream );
   341     rootStream.CommitL();
   341     rootStream.CommitL();
   342 
   342 
   343     // Commit the store
   343     // Commit the store
   344     iStore->CommitL();
   344     iStore->CommitL();
   345     
   345 
   346     CleanupStack::PopAndDestroy();  // root stream
   346     CleanupStack::PopAndDestroy();  // root stream
   347     
   347 
   348     // Compact and commit the changes
   348     // Compact and commit the changes
   349     iStore->CompactL();
   349     iStore->CompactL();
   350     iStore->CommitL();        
   350     iStore->CommitL();
   351     };
   351     };
   352                            
   352 
   353 // -----------------------------------------------------------------------------
   353 // -----------------------------------------------------------------------------
   354 // CDRMRightsData::FetchAllPermissionsL
   354 // CDRMRightsData::FetchAllPermissionsL
   355 // -----------------------------------------------------------------------------
   355 // -----------------------------------------------------------------------------
   356 //
   356 //
   357 void CDRMRightsData::FetchAllPermissionsL( RPointerArray<CDRMPermission>& 
   357 void CDRMRightsData::FetchAllPermissionsL( RPointerArray<CDRMPermission>&
   358                                            aPointerArray)
   358                                            aPointerArray)
   359     {
   359     {
   360     CDRMPermission* perm = NULL;
   360     CDRMPermission* perm = NULL;
   361 
   361 
   362     if ( iArray.Count() == 0) 
   362     if ( iArray.Count() == 0)
   363         {
   363         {
   364         User::Leave( KErrCANoPermission );
   364         User::Leave( KErrCANoPermission );
   365         }
   365         }
   366     
   366 
   367     for( TInt count = 0; count < iArray.Count(); count++ )
   367     for( TInt count = 0; count < iArray.Count(); count++ )
   368         {
   368         {
   369         perm = CDRMPermission::NewLC();
   369         perm = CDRMPermission::NewLC();
   370         FetchPermissionL( *perm, iArray[ count ] );
   370         FetchPermissionL( *perm, iArray[ count ] );
   371         aPointerArray.AppendL( perm );
   371         aPointerArray.AppendL( perm );
   372 		CleanupStack::Pop();
   372         CleanupStack::Pop();
   373         }
   373         }
   374     };    
   374     };
   375 
   375 
   376 // -----------------------------------------------------------------------------
   376 // -----------------------------------------------------------------------------
   377 // CDRMRightsData::DeleteAllPermissionsL
   377 // CDRMRightsData::DeleteAllPermissionsL
   378 // -----------------------------------------------------------------------------
   378 // -----------------------------------------------------------------------------
   379 //
   379 //
   380 void CDRMRightsData::DeleteAllPermissionsL()
   380 void CDRMRightsData::DeleteAllPermissionsL()
   381     {
   381     {
   382     TStreamId rootId;
   382     TStreamId rootId;
   383     RStoreWriteStream rootStream;
   383     RStoreWriteStream rootStream;
   384     
   384 
   385     // Delete all permissions from the store
   385     // Delete all permissions from the store
   386     for( TInt i = 0; i < iArray.Count(); i++ )
   386     for( TInt i = 0; i < iArray.Count(); i++ )
   387         {
   387         {
   388         TStreamId sid( iArray[i] );
   388         TStreamId sid( iArray[i] );
   389         iStore->DeleteL( sid );
   389         iStore->DeleteL( sid );
   390         }
   390         }
   391         
   391 
   392     // Reset the array    
   392     // Reset the array
   393     iArray.Reset();
   393     iArray.Reset();
   394     
   394 
   395     // Get the stream id of the root
   395     // Get the stream id of the root
   396     rootId = iStore->Root();
   396     rootId = iStore->Root();
   397     
   397 
   398     // Open the root stream
   398     // Open the root stream
   399     rootStream.ReplaceLC( *iStore, rootId );
   399     rootStream.ReplaceLC( *iStore, rootId );
   400         
   400 
   401     // Store the changed index
   401     // Store the changed index
   402     StoreIndexL( rootStream );    
   402     StoreIndexL( rootStream );
   403     rootStream.CommitL();
   403     rootStream.CommitL();
   404 
   404 
   405     // Commit the store
   405     // Commit the store
   406     iStore->CommitL();
   406     iStore->CommitL();
   407     
   407 
   408     CleanupStack::PopAndDestroy();  // root stream
   408     CleanupStack::PopAndDestroy();  // root stream
   409     
   409 
   410     // Compact and Commit the store
   410     // Compact and Commit the store
   411     iStore->CompactL();
   411     iStore->CompactL();
   412     iStore->CommitL();          
   412     iStore->CommitL();
   413     };
   413     };
   414 
   414 
   415 // -----------------------------------------------------------------------------
   415 // -----------------------------------------------------------------------------
   416 // CDRMRightsData::DeleteExpiredPermissionsL
   416 // CDRMRightsData::DeleteExpiredPermissionsL
   417 // Deletes all rights objects which have been expired
   417 // Deletes all rights objects which have been expired
   418 // if the given time aTime is Time::NullTTime() then
   418 // if the given time aTime is Time::NullTTime() then
   419 // deletes only non time based rights
   419 // deletes only non time based rights
   420 // -----------------------------------------------------------------------------
   420 // -----------------------------------------------------------------------------
   421 //
   421 //
   422 TInt CDRMRightsData::DeleteExpiredPermissionsL( const TTime& aTime, TBool& aParents )
   422 TInt CDRMRightsData::DeleteExpiredPermissionsL( const TTime& aTime, TBool& aParents )
   423 	{
   423     {
   424 	CDRMPermission* permission = NULL;	   
   424     CDRMPermission* permission = NULL;
   425     RStoreReadStream stream;   
   425     RStoreReadStream stream;
   426     TStreamId rootId;
   426     TStreamId rootId;
   427     RStoreWriteStream rootStream;
   427     RStoreWriteStream rootStream;
   428     TBool remove = EFalse;
   428     TBool remove = EFalse;
   429     TInt k = 0;
   429     TInt k = 0;
   430     TBool performDelete = ETrue;
   430     TBool performDelete = ETrue;
   431     
   431 
   432     // A list for the permissions:
   432     // A list for the permissions:
   433     CDRMPointerArray<CDRMPermission>* permList = CDRMPointerArray<CDRMPermission>::NewLC();
   433     CDRMPointerArray<CDRMPermission>* permList = CDRMPointerArray<CDRMPermission>::NewLC();
   434     permList->SetAutoCleanup( ETrue );
   434     permList->SetAutoCleanup( ETrue );
   435     CDRMPointerArray<TPermData>* permDataList = CDRMPointerArray<TPermData>::NewLC();
   435     CDRMPointerArray<TPermData>* permDataList = CDRMPointerArray<TPermData>::NewLC();
   436     permDataList->SetAutoCleanup( ETrue );
   436     permDataList->SetAutoCleanup( ETrue );
   437     
   437 
   438     // Fill the array:
   438     // Fill the array:
   439     for( TInt j = 0  ; j < iArray.Count(); j++ )
   439     for( TInt j = 0  ; j < iArray.Count(); j++ )
   440         {
   440         {
   441         TPermData* perm = NULL;
   441         TPermData* perm = NULL;
   442         // Create the sid:
   442         // Create the sid:
   443         TStreamId psid( iArray[j] );
   443         TStreamId psid( iArray[j] );
   444 
   444 
   445     	// Open the correct stream
   445         // Open the correct stream
   446     	stream.OpenLC( *iStore, psid );
   446         stream.OpenLC( *iStore, psid );
   447 
   447 
   448 	    permission = CDRMPermission::NewLC();
   448         permission = CDRMPermission::NewLC();
   449 
   449 
   450     	// Read the permission
   450         // Read the permission
   451     	permission->InternalizeL( stream );
   451         permission->InternalizeL( stream );
   452     
   452 
   453         permList->AppendL( permission );
   453         permList->AppendL( permission );
   454     	CleanupStack::Pop(); // permission
   454         CleanupStack::Pop(); // permission
   455     	        
   455 
   456         // if the permission has a parent check if we found now or have found an
   456         // if the permission has a parent check if we found now or have found an
   457         // expired one or a valid one,
   457         // expired one or a valid one,
   458         // store info if required 
   458         // store info if required
   459         if( permission->iParentUID )
   459         if( permission->iParentUID )
   460             {
   460             {
   461             if( !aParents ) 
   461             if( !aParents )
   462                 {
   462                 {
   463                 aParents = ETrue;
   463                 aParents = ETrue;
   464                 }
   464                 }
   465             
   465 
   466             for( k = 0; k < permDataList->Count(); k++ )
   466             for( k = 0; k < permDataList->Count(); k++ )
   467                 {
   467                 {
   468                 if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID ) )
   468                 if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID ) )
   469                     {
   469                     {
   470                     if( !(*permDataList)[k]->iIsValid && !permission->Expired( aTime ) )
   470                     if( !(*permDataList)[k]->iIsValid && !permission->Expired( aTime ) )
   474                         (*permDataList)[k]->iIsValid = ETrue;
   474                         (*permDataList)[k]->iIsValid = ETrue;
   475                         }
   475                         }
   476                     break;
   476                     break;
   477                     }
   477                     }
   478                 }
   478                 }
   479                 
   479 
   480             // if it's not found, add it:
   480             // if it's not found, add it:
   481             if( k == permDataList->Count() )
   481             if( k == permDataList->Count() )
   482                 {
   482                 {
   483                 if( !permission->Expired( aTime ) )
   483                 if( !permission->Expired( aTime ) )
   484                     {
   484                     {
   485                     perm = new(ELeave) TPermData( permission->iParentUID, j, ETrue);
   485                     perm = new(ELeave) TPermData( permission->iParentUID, j, ETrue);
   486                     }
   486                     }
   487                 else 
   487                 else
   488                     {
   488                     {
   489                     perm = new(ELeave) TPermData( permission->iParentUID, j, EFalse);                       
   489                     perm = new(ELeave) TPermData( permission->iParentUID, j, EFalse);
   490                     }
   490                     }
   491                 CleanupStack::PushL( perm );
   491                 CleanupStack::PushL( perm );
   492                 permDataList->AppendL( perm );
   492                 permDataList->AppendL( perm );
   493                 CleanupStack::Pop(); // perm   
   493                 CleanupStack::Pop(); // perm
   494                 }
   494                 }
   495             }
   495             }
   496         
   496 
   497         // Close the stream
   497         // Close the stream
   498     	CleanupStack::PopAndDestroy();  // stream       
   498         CleanupStack::PopAndDestroy();  // stream
   499         }
   499         }
   500           
   500 
   501 
   501 
   502     // Delete all expired permissions from the store
   502     // Delete all expired permissions from the store
   503     for( TInt i = iArray.Count() - 1 ; i >= 0; i-- )
   503     for( TInt i = iArray.Count() - 1 ; i >= 0; i-- )
   504         {
   504         {
   505         permission = (*permList)[i];
   505         permission = (*permList)[i];
   506         
   506 
   507 		// Check if the permission is expired
   507         // Check if the permission is expired
   508 		// if it is, check if it has a parent and if it can be deleted
   508         // if it is, check if it has a parent and if it can be deleted
   509 		if( permission->Expired( aTime ) )
   509         if( permission->Expired( aTime ) )
   510 			{
   510             {
   511 			// if it has a parent go through the list and see if this can be deleted
   511             // if it has a parent go through the list and see if this can be deleted
   512 			// or not
   512             // or not
   513 			if( permission->iParentUID )
   513             if( permission->iParentUID )
   514 			    {
   514                 {
   515 			    performDelete = EFalse;
   515                 performDelete = EFalse;
   516 			    for( k = 0; k < permDataList->Count(); k++ )
   516                 for( k = 0; k < permDataList->Count(); k++ )
   517 			        {
   517                     {
   518 			        TPermData* aData = (*permDataList)[k];
   518                     TPermData* aData = (*permDataList)[k];
   519 			        
   519 
   520 			        // since it's set up like this a pointer comparison is enough:
   520                     // since it's set up like this a pointer comparison is enough:
   521 			        if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID  ) ) 
   521                     if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID  ) )
   522 			            {
   522                         {
   523 			            if( i != (*permDataList)[k]->iIndex ) 
   523                         if( i != (*permDataList)[k]->iIndex )
   524 			                {
   524                             {
   525 			                performDelete = ETrue;
   525                             performDelete = ETrue;
   526 			                }
   526                             }
   527 			            }
   527                         }
   528 			        }
   528                     }
   529 			    }
   529                 }
   530 			
   530 
   531 		    if( performDelete )	
   531             if( performDelete )
   532 		        {
   532                 {
   533                 // Create the sid:
   533                 // Create the sid:
   534                 TStreamId sid( iArray[i] );
   534                 TStreamId sid( iArray[i] );
   535                 		        
   535 
   536 			    iStore->Delete( sid );
   536                 iStore->Delete( sid );
   537 			
   537 
   538 	            // remove from the array		
   538                 // remove from the array
   539 		        iArray.Remove( i );				
   539                 iArray.Remove( i );
   540 		    
   540 
   541 		        if( !remove )
   541                 if( !remove )
   542 		            {
   542                     {
   543 		            remove = ETrue;    
   543                     remove = ETrue;
   544 		            }
   544                     }
   545 			    }    
   545                 }
   546 			}
   546             }
   547 		performDelete = ETrue;			
   547         performDelete = ETrue;
   548         }
   548         }
   549 
   549 
   550     CleanupStack::PopAndDestroy( 2 ); // permDataList, permList 
   550     CleanupStack::PopAndDestroy( 2 ); // permDataList, permList
   551         
   551 
   552     // Write the data into the the file   
   552     // Write the data into the the file
   553     // if some of the rights have been removed
   553     // if some of the rights have been removed
   554     if( remove ) 
   554     if( remove )
   555         {
   555         {
   556         // Get the stream id of the root
   556         // Get the stream id of the root
   557         rootId = iStore->Root();
   557         rootId = iStore->Root();
   558     
   558 
   559         // Open the root stream
   559         // Open the root stream
   560         rootStream.ReplaceLC( *iStore, rootId );
   560         rootStream.ReplaceLC( *iStore, rootId );
   561         
   561 
   562         // Store the changed index
   562         // Store the changed index
   563         StoreIndexL( rootStream );    
   563         StoreIndexL( rootStream );
   564         rootStream.CommitL();
   564         rootStream.CommitL();
   565 
   565 
   566         // Commit the store
   566         // Commit the store
   567         iStore->CommitL();
   567         iStore->CommitL();
   568     
   568 
   569         CleanupStack::PopAndDestroy();  // root stream
   569         CleanupStack::PopAndDestroy();  // root stream
   570         
   570 
   571         // Compact and Commit the store
   571         // Compact and Commit the store
   572         iStore->CompactL();
   572         iStore->CompactL();
   573         iStore->CommitL();             
   573         iStore->CommitL();
   574         }
   574         }
   575            
   575 
   576 	return iArray.Count();	
   576     return iArray.Count();
   577 	}
   577     }
   578 
   578 
   579     
   579 
   580 // -----------------------------------------------------------------------------
   580 // -----------------------------------------------------------------------------
   581 // CDRMRightsData::StoreKeyL
   581 // CDRMRightsData::StoreKeyL
   582 // -----------------------------------------------------------------------------
   582 // -----------------------------------------------------------------------------
   583 //
   583 //
   584 void CDRMRightsData::StoreKeyL()
   584 void CDRMRightsData::StoreKeyL()
   585     {
   585     {
   586     RStoreWriteStream stream;
   586     RStoreWriteStream stream;
   587     TUint32 size = 0;
   587     TUint32 size = 0;
   588     
   588 
   589     stream.OpenLC( *iStore, iKeyId );
   589     stream.OpenLC( *iStore, iKeyId );
   590     
   590 
   591     if( iKeyExists ) 
   591     if( iKeyExists )
   592         {
   592         {
   593         size = KEncryptionKeySize;
   593         size = KEncryptionKeySize;
   594         }
   594         }
   595         
   595 
   596     stream.WriteUint32L( size );        
   596     stream.WriteUint32L( size );
   597     
   597 
   598     if( size )
   598     if( size )
   599         {
   599         {
   600         stream.WriteL( iKey, KEncryptionKeySize );        
   600         stream.WriteL( iKey, KEncryptionKeySize );
   601         }
   601         }
   602         
   602 
   603     stream.CommitL();
   603     stream.CommitL();
   604     iStore->CommitL();
   604     iStore->CommitL();
   605         
   605 
   606     CleanupStack::PopAndDestroy();
   606     CleanupStack::PopAndDestroy();
   607     };
   607     };
   608 
   608 
   609 // -----------------------------------------------------------------------------
   609 // -----------------------------------------------------------------------------
   610 // CDRMRightsData::GetKeyL
   610 // CDRMRightsData::GetKeyL
   611 // -----------------------------------------------------------------------------
   611 // -----------------------------------------------------------------------------
   612 //
   612 //
   613 HBufC8* CDRMRightsData::GetKeyL() const
   613 HBufC8* CDRMRightsData::GetKeyL() const
   614     {
   614     {
   615     HBufC8* key = NULL;
   615     HBufC8* key = NULL;
   616     
   616 
   617     if( iKeyExists )
   617     if( iKeyExists )
   618         {
   618         {
   619         key = HBufC8::NewL( KEncryptionKeySize );
   619         key = HBufC8::NewL( KEncryptionKeySize );
   620         *key = iKey;
   620         *key = iKey;
   621         }
   621         }
   622         
   622 
   623     return key;
   623     return key;
   624     }
   624     }
   625         
   625 
   626 // -----------------------------------------------------------------------------
   626 // -----------------------------------------------------------------------------
   627 // CDRMRightsData::FetchKeyL
   627 // CDRMRightsData::FetchKeyL
   628 // -----------------------------------------------------------------------------
   628 // -----------------------------------------------------------------------------
   629 //
   629 //
   630 void CDRMRightsData::FetchKeyL()
   630 void CDRMRightsData::FetchKeyL()
   631     {
   631     {
   632     RStoreReadStream stream;
   632     RStoreReadStream stream;
   633     TUint32 size = 0;
   633     TUint32 size = 0;
   634     
   634 
   635     // Open the root stream
   635     // Open the root stream
   636     stream.OpenLC( *iStore, iKeyId );
   636     stream.OpenLC( *iStore, iKeyId );
   637     
   637 
   638     size = stream.ReadUint32L();  
   638     size = stream.ReadUint32L();
   639     
   639 
   640     if( !size ) 
   640     if( !size )
   641         {
   641         {
   642         iKeyExists = EFalse;
   642         iKeyExists = EFalse;
   643         }
   643         }
   644     else 
   644     else
   645         {
   645         {
   646         stream.ReadL( iKey, KEncryptionKeySize );
   646         stream.ReadL( iKey, KEncryptionKeySize );
   647         iKeyExists = ETrue;
   647         iKeyExists = ETrue;
   648         }
   648         }
   649     
   649 
   650     CleanupStack::PopAndDestroy();    
   650     CleanupStack::PopAndDestroy();
   651     };
   651     };
   652 
   652 
   653 // -----------------------------------------------------------------------------
   653 // -----------------------------------------------------------------------------
   654 // CDRMRightsData::CreateAndInitializeStoreL
   654 // CDRMRightsData::CreateAndInitializeStoreL
   655 // -----------------------------------------------------------------------------
   655 // -----------------------------------------------------------------------------
   656 //
   656 //
   657 void CDRMRightsData::CreateAndInitializeStoreL( const TFileName& aRightsStore )
   657 void CDRMRightsData::CreateAndInitializeStoreL( const TFileName& aRightsStore )
   658     {
   658     {
   659     TStreamId rootId;
   659     TStreamId rootId;
   660     RStoreWriteStream stream;
   660     RStoreWriteStream stream;
   661     RStoreWriteStream stream2;    
   661     RStoreWriteStream stream2;
   662     RStoreWriteStream rootStream;
   662     RStoreWriteStream rootStream;
   663     TUint32 size = 0;    
   663     TUint32 size = 0;
   664     
   664 
   665     // Create and initialize the permanent file store
   665     // Create and initialize the permanent file store
   666     iStore = CPermanentFileStore::ReplaceL( iFileServer, aRightsStore,
   666     iStore = CPermanentFileStore::ReplaceL( iFileServer, aRightsStore,
   667                                             EFileRead|EFileWrite );                                          
   667                                             EFileRead|EFileWrite );
   668     iStore->SetTypeL( KPermanentFileStoreLayoutUid );
   668     iStore->SetTypeL( KPermanentFileStoreLayoutUid );
   669     iStore->CommitL(); 
   669     iStore->CommitL();
   670     
   670 
   671     // Create the root stream:                                                   
   671     // Create the root stream:
   672     rootId = rootStream.CreateLC( *iStore );
   672     rootId = rootStream.CreateLC( *iStore );
   673     rootStream.CommitL();
   673     rootStream.CommitL();
   674     iStore->SetRootL( rootId );    
   674     iStore->SetRootL( rootId );
   675     iStore->CommitL(); 
   675     iStore->CommitL();
   676         
   676 
   677     // Create the common data
   677     // Create the common data
   678     iCommonId = stream.CreateLC( *iStore );
   678     iCommonId = stream.CreateLC( *iStore );
   679     iData->ExternalizeL( stream );
   679     iData->ExternalizeL( stream );
   680     stream.CommitL();
   680     stream.CommitL();
   681     iStore->CommitL(); 
   681     iStore->CommitL();
   682         
   682 
   683     CleanupStack::PopAndDestroy(); // stream
   683     CleanupStack::PopAndDestroy(); // stream
   684     
   684 
   685     // Create the key
   685     // Create the key
   686     iKeyId = stream2.CreateLC( *iStore );
   686     iKeyId = stream2.CreateLC( *iStore );
   687 
   687 
   688     // if the key exists set the key size accordingly
   688     // if the key exists set the key size accordingly
   689     if( iKeyExists ) 
   689     if( iKeyExists )
   690         {
   690         {
   691         size = KEncryptionKeySize;
   691         size = KEncryptionKeySize;
   692         }
   692         }
   693     stream2.WriteUint32L( size );
   693     stream2.WriteUint32L( size );
   694 
   694 
   695     if( size )
   695     if( size )
   696         {
   696         {
   697         stream2.WriteL( iKey, KEncryptionKeySize );
   697         stream2.WriteL( iKey, KEncryptionKeySize );
   698         }
   698         }
   699     stream2.CommitL();
   699     stream2.CommitL();
   700     iStore->CommitL(); 
   700     iStore->CommitL();
   701            
   701 
   702     CleanupStack::PopAndDestroy(); // stream2                                      
   702     CleanupStack::PopAndDestroy(); // stream2
   703     CleanupStack::PopAndDestroy(); // rootStream  
   703     CleanupStack::PopAndDestroy(); // rootStream
   704     
   704 
   705     // Create the index now that we have all the data
   705     // Create the index now that we have all the data
   706     rootId = iStore->Root(); 
   706     rootId = iStore->Root();
   707     
   707 
   708     rootStream.ReplaceLC(*iStore, rootId);
   708     rootStream.ReplaceLC(*iStore, rootId);
   709     StoreIndexL( rootStream );
   709     StoreIndexL( rootStream );
   710     rootStream.CommitL();
   710     rootStream.CommitL();
   711     iStore->CommitL(); 
   711     iStore->CommitL();
   712         
   712 
   713     // Commit the changes to the store as well
   713     // Commit the changes to the store as well
   714     CleanupStack::PopAndDestroy(); // rootStream       
   714     CleanupStack::PopAndDestroy(); // rootStream
   715     };
   715     };
   716 
   716 
   717 
   717 
   718 // -----------------------------------------------------------------------------
   718 // -----------------------------------------------------------------------------
   719 // CDRMRightsData::StoreIndexL
   719 // CDRMRightsData::StoreIndexL
   721 //
   721 //
   722 void CDRMRightsData::StoreIndexL( RWriteStream& aStream ) const
   722 void CDRMRightsData::StoreIndexL( RWriteStream& aStream ) const
   723     {
   723     {
   724     // Write the common id to the stream
   724     // Write the common id to the stream
   725     iCommonId.ExternalizeL( aStream );
   725     iCommonId.ExternalizeL( aStream );
   726     
   726 
   727     // Write the key id to the stream
   727     // Write the key id to the stream
   728     iKeyId.ExternalizeL( aStream );
   728     iKeyId.ExternalizeL( aStream );
   729     
   729 
   730     // Write the array size and possibly the array to the stream
   730     // Write the array size and possibly the array to the stream
   731     aStream.WriteInt32L( iArray.Count() );
   731     aStream.WriteInt32L( iArray.Count() );
   732     
   732 
   733     for( TInt count = 0; count < iArray.Count(); count++ )
   733     for( TInt count = 0; count < iArray.Count(); count++ )
   734         {
   734         {
   735         aStream.WriteUint32L( iArray[ count ] );
   735         aStream.WriteUint32L( iArray[ count ] );
   736         }
   736         }
   737     };
   737     };
   738     
   738 
   739 // -----------------------------------------------------------------------------
   739 // -----------------------------------------------------------------------------
   740 // CDRMRightsData::FetchIndexL
   740 // CDRMRightsData::FetchIndexL
   741 // -----------------------------------------------------------------------------
   741 // -----------------------------------------------------------------------------
   742 //
   742 //
   743 void CDRMRightsData::FetchIndexL()
   743 void CDRMRightsData::FetchIndexL()
   744     {
   744     {
   745     TStreamId rootId;
   745     TStreamId rootId;
   746     RStoreReadStream stream;
   746     RStoreReadStream stream;
   747     TInt count = 0;
   747     TInt count = 0;
   748     TDRMUniqueID id;
   748     TDRMUniqueID id;
   749  
   749 
   750     // Get the stream id of the root
   750     // Get the stream id of the root
   751     rootId = iStore->Root();
   751     rootId = iStore->Root();
   752     
   752 
   753     // Open the root stream
   753     // Open the root stream
   754     stream.OpenLC( *iStore, rootId );
   754     stream.OpenLC( *iStore, rootId );
   755     
   755 
   756     // Do the actual reading, reading also the key id and the common id
   756     // Do the actual reading, reading also the key id and the common id
   757 
   757 
   758     // Read the common id
   758     // Read the common id
   759     iCommonId.InternalizeL( stream );
   759     iCommonId.InternalizeL( stream );
   760     
   760 
   761     // Read the key id 
   761     // Read the key id
   762     iKeyId.InternalizeL( stream );
   762     iKeyId.InternalizeL( stream );
   763     
   763 
   764     // read the count of the array:
   764     // read the count of the array:
   765     iArray.Reset();
   765     iArray.Reset();
   766     
   766 
   767     count = stream.ReadInt32L();
   767     count = stream.ReadInt32L();
   768     
   768 
   769     for( ; count > 0; count-- )
   769     for( ; count > 0; count-- )
   770         {
   770         {
   771         id = stream.ReadUint32L();
   771         id = stream.ReadUint32L();
   772         iArray.InsertInUnsignedKeyOrder( id );
   772         iArray.InsertInUnsignedKeyOrder( id );
   773         }
   773         }
   774      
   774 
   775     // Close the stream
   775     // Close the stream
   776     CleanupStack::PopAndDestroy();    
   776     CleanupStack::PopAndDestroy();
   777     };
   777     };
   778     
   778 
   779 // -----------------------------------------------------------------------------
   779 // -----------------------------------------------------------------------------
   780 // CDRMRightsData::FetchCommonDataL
   780 // CDRMRightsData::FetchCommonDataL
   781 // -----------------------------------------------------------------------------
   781 // -----------------------------------------------------------------------------
   782 //
   782 //
   783 void CDRMRightsData::FetchCommonDataL()
   783 void CDRMRightsData::FetchCommonDataL()
   784     {
   784     {
   785     RStoreReadStream stream;
   785     RStoreReadStream stream;
   786     
   786 
   787     // Open the root stream
   787     // Open the root stream
   788     stream.OpenLC( *iStore, iCommonId );
   788     stream.OpenLC( *iStore, iCommonId );
   789     
   789 
   790     iData->InternalizeL( stream );
   790     iData->InternalizeL( stream );
   791     
   791 
   792     CleanupStack::PopAndDestroy();
   792     CleanupStack::PopAndDestroy();
   793     };
   793     };
   794     
   794 
   795 
   795 
   796 // -----------------------------------------------------------------------------
   796 // -----------------------------------------------------------------------------
   797 // Default Constructor - First phase.
   797 // Default Constructor - First phase.
   798 // Can be used by itself to generate an empty object
   798 // Can be used by itself to generate an empty object
   799 // -----------------------------------------------------------------------------
   799 // -----------------------------------------------------------------------------
   809 //
   809 //
   810 void CDRMRightsData::ConstructL( const TFileName& aRightsStore )
   810 void CDRMRightsData::ConstructL( const TFileName& aRightsStore )
   811     {
   811     {
   812     // Open the file store
   812     // Open the file store
   813     iStore = CPermanentFileStore::OpenL( iFileServer, aRightsStore, EFileRead|EFileWrite );
   813     iStore = CPermanentFileStore::OpenL( iFileServer, aRightsStore, EFileRead|EFileWrite );
   814     
   814 
   815     // Get the index
   815     // Get the index
   816     FetchIndexL();
   816     FetchIndexL();
   817     
   817 
   818     // Get the common data
   818     // Get the common data
   819     FetchCommonDataL();
   819     FetchCommonDataL();
   820     
   820 
   821     // Get the key
   821     // Get the key
   822     FetchKeyL();
   822     FetchKeyL();
   823     };
   823     };
   824 
   824 
   825 // -----------------------------------------------------------------------------
   825 // -----------------------------------------------------------------------------
   827 // -----------------------------------------------------------------------------
   827 // -----------------------------------------------------------------------------
   828 //
   828 //
   829 void CDRMRightsData::ConstructL( const TFileName& aRightsStore,
   829 void CDRMRightsData::ConstructL( const TFileName& aRightsStore,
   830                                  const TDesC8& aKey )
   830                                  const TDesC8& aKey )
   831     {
   831     {
   832     
   832 
   833     // Check if the key is given or a null desc
   833     // Check if the key is given or a null desc
   834     if( aKey.Length() ) 
   834     if( aKey.Length() )
   835         {
   835         {
   836         iKey = aKey;
   836         iKey = aKey;
   837         iKeyExists = ETrue;
   837         iKeyExists = ETrue;
   838         }
   838         }
   839     else
   839     else
   840         {
   840         {
   841         iKeyExists = EFalse;
   841         iKeyExists = EFalse;
   842         }    
   842         }
   843     
   843 
   844     // Creates the required stores and indexes
   844     // Creates the required stores and indexes
   845     CreateAndInitializeStoreL( aRightsStore );
   845     CreateAndInitializeStoreL( aRightsStore );
   846     };
   846     };
   847     
   847 
   848             
   848 
   849 // End of File
   849 // End of File