24 // #include <SysUtil.h> // Disk space checking |
24 // #include <SysUtil.h> // Disk space checking |
25 #include <f32file.h> |
25 #include <f32file.h> |
26 #include <s32strm.h> |
26 #include <s32strm.h> |
27 #include <s32file.h> |
27 #include <s32file.h> |
28 #include <caf/caf.h> |
28 #include <caf/caf.h> |
|
29 #include <caf/cafplatform.h> |
29 #include <symmetric.h> // AES128CBC |
30 #include <symmetric.h> // AES128CBC |
30 #include <dcfrep.h> |
31 #include <DcfRep.h> |
31 |
32 |
32 #ifdef RD_MULTIPLE_DRIVE |
33 #ifdef RD_MULTIPLE_DRIVE |
33 #include <DriveInfo.h> |
34 #include <driveinfo.h> |
34 #endif |
35 #endif |
35 |
36 |
36 #include "DRMCommon.h" // DRM Error messages |
37 #include "DRMCommon.h" // DRM Error messages |
37 #include "DRMRightsDB.h" |
38 #include "drmrightsdb.h" |
38 #include "DRMRightsData.h" |
39 #include "DRMRightsData.h" |
39 #include "DRMCommonData.h" |
40 #include "DRMCommonData.h" |
40 #include "DRMPermission.h" |
41 #include "DrmPermission.h" |
41 #include "DRMConstraint.h" |
42 #include "DrmConstraint.h" |
42 #include "DRMRightsCleaner.h" |
43 #include "DRMRightsCleaner.h" |
43 #include "DRMRightsServer.h" |
44 #include "DRMRightsServer.h" |
44 #include "DrmKeyStorage.h" |
45 #include "DrmKeyStorage.h" |
45 #include "utf.h" // charconv, ConvertFromUnicodeToUtf8L |
46 #include "utf.h" // charconv, ConvertFromUnicodeToUtf8L |
46 #include "drmlog.h" |
47 #include "drmlog.h" |
47 |
48 |
48 #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL |
49 #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL |
49 #include "drmclockclient.h" |
50 #include "DRMClockClient.h" |
50 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL |
51 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL |
51 |
52 |
52 /* |
53 /* |
53 #include "flogger.h" |
54 #include "flogger.h" |
54 |
55 |
290 TTime time; |
291 TTime time; |
291 TBool deleteAllowed = EFalse; |
292 TBool deleteAllowed = EFalse; |
292 TInt timeZone = 0; |
293 TInt timeZone = 0; |
293 DRMClock::ESecurityLevel securityLevel; |
294 DRMClock::ESecurityLevel securityLevel; |
294 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL |
295 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL |
295 |
296 |
296 GetRightsFileNameL( aContentID, path); |
297 GetRightsFileNameL( aContentID, path); |
297 |
298 |
298 #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL |
299 #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL |
299 // Get the secure time: |
300 // Get the secure time: |
300 RDRMClockClient client; |
301 RDRMClockClient client; |
301 error = client.Connect(); |
302 error = client.Connect(); |
302 if( !error ) |
303 if( !error ) |
313 time = Time::NullTTime(); |
314 time = Time::NullTTime(); |
314 } |
315 } |
315 |
316 |
316 // Delete expired: |
317 // Delete expired: |
317 TRAP_IGNORE( deleteAllowed = DeleteExpiredL( path, time ) ); |
318 TRAP_IGNORE( deleteAllowed = DeleteExpiredL( path, time ) ); |
318 |
319 |
319 // Check if it's possible to delete the file as well |
320 // Check if it's possible to delete the file as well |
320 if( deleteAllowed ) |
321 if( deleteAllowed ) |
321 { |
322 { |
322 iFileServer.Delete( path ); |
323 iFileServer.Delete( path ); |
323 } |
324 } |
324 |
325 |
325 error = KErrNone; |
326 error = KErrNone; |
326 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL |
327 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL |
327 |
328 |
328 TRAP( error, rights = CDRMRightsData::OpenL( path, iFileServer ) ); |
329 TRAP( error, rights = CDRMRightsData::OpenL( path, iFileServer ) ); |
329 if( rights ) |
330 if( rights ) |
417 // the key can either be empty or it can be 16 characters: |
418 // the key can either be empty or it can be 16 characters: |
418 if( !( aEncryptionKey.Length() == KEncryptionKeySize || aEncryptionKey.Length() == 0 ) ) |
419 if( !( aEncryptionKey.Length() == KEncryptionKeySize || aEncryptionKey.Length() == 0 ) ) |
419 { |
420 { |
420 User::Leave(KErrArgument); |
421 User::Leave(KErrArgument); |
421 } |
422 } |
422 |
423 |
423 TBuf8<16> keyStore = aEncryptionKey; |
424 TBuf8<16> keyStore = aEncryptionKey; |
424 // TBuf8<16> authStore = aAuthenticationSeed |
425 // TBuf8<16> authStore = aAuthenticationSeed |
425 |
426 |
426 // Encrypt the key |
427 // Encrypt the key |
427 ModifyKey( keyStore ); |
428 ModifyKey( keyStore ); |