# How to protect playback of separate groups of files from the same VOD application?

**URL:** https://community.wowza.com/t/how-to-protect-playback-of-separate-groups-of-files-from-the-same-vod-application/46896
**Category:** Wowza Streaming Engine
**Created:** [April 14, 2016, 9:32am UTC](https://community.wowza.com/t/how-to-protect-playback-of-separate-groups-of-files-from-the-same-vod-application/46896 "2016-04-14T09:32:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Stefano\_Caporale](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@Stefano\_Caporale](https://community.wowza.com/u/Stefano_Caporale)
#### Post date: [April 14, 2016, 9:32am UTC](https://community.wowza.com/t/how-to-protect-playback-of-separate-groups-of-files-from-the-same-vod-application/46896/1 "2016-04-14T09:32:27Z")

</div>

Hello everybody.

I know Wowza Streaming Engine supports token protection for each VOD application. Though I need to protect each groups of files (maybe in subfolders) of the same VOD application with its own different token. Is there a way to achieve this on Wowza, maybe with some existing module, or do I have to write my own module?

---

<div class="post-metadata">

### Author: ![Paul\_Shields](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/paul_shields/32/390_2.png) [@Paul\_Shields](https://community.wowza.com/u/Paul_Shields)
#### Post date: [April 20, 2016, 2:49pm UTC](https://community.wowza.com/t/how-to-protect-playback-of-separate-groups-of-files-from-the-same-vod-application/46896/2 "2016-04-20T14:49:14Z")

</div>

Hi,

If using Secure Token (v2) then the hash includes the stream name, e.g.the file sample.mp4 played back in the ‘vod’ application

[PHP]

$stream = “vod/_definst_/mp4:sample.mp4”;

$start = time();

$end = strtotime("+30 minutes");

$secret = “abcde”;

$tokenName = “wowzatoken”;

[/PHP]

Hash calculation made by playback client:

[PHP]

$hash = hash(‘sha384’, $stream."?".$secret."&{$tokenName}endtime=".$end."&{$tokenName}starttime=".$start, true);

[/PHP]

So the hash should be unique for each stream. You would just need to amend the $stream value for each stream you request. If your files are in sub-folders under the defined storage dir then that can be included in the $stream, e.g.

```auto
 $stream = "vod/myfolder/mp4:sample.mp4";

```

We have a sample PHP script that can be used as a basis for calculating and optionally playing embedding a player for secure token streams. Feel free to request it if required.

Paul
