> For the complete documentation index, see [llms.txt](https://clients.medianova.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clients.medianova.com/products/security/security-token/md5-secure-token.md). Agents can also search and read this documentation through its [MCP server](https://clients.medianova.com/~gitbook/mcp).

# MD5 Secure Token

Learn how to configure MD5 Secure Token and generate time-limited URLs using platform-specific hexadecimal MD5 signatures.

MD5 Secure Token protects CDN content using signed URLs with expiration timestamps. It generates a 32-character hexadecimal MD5 signature from a secret key, content path, and expiration time.

Unlike other Security Token types, MD5 Secure Token uses different signing formats for different CDN Resource types.

Your application must generate the signature using the format supported by the selected CDN Resource.

### How MD5 Secure Token works

MD5 Secure Token validates requests at the CDN edge before serving protected content.

The process includes four stages:

1. **Token generation:** Your application generates an MD5 signature using the Token Key, content path, and expiration timestamp.
2. **Content request:** The viewer requests the signed URL with its signature and expiration parameters.
3. **Token validation:** Medianova CDN recalculates the signature and checks the expiration time.
4. **Request handling:** The CDN processes valid requests and rejects invalid or expired tokens.

<figure><img src="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2FqpRrsuahiE5Y8AoGoRox%2Fimage.png?alt=media&amp;token=2ad93f54-f305-44f1-ae5e-3ed98f4fb880" alt="" width="553"><figcaption><p>MD5 Secure Token signing inputs for Large CDN and Large Streaming.</p></figcaption></figure>

The Token Key remains on your application backend and in the CDN Resource configuration.

{% hint style="info" %}
MD5 Secure Token does not bind URLs to a viewer's IP address, country, or identity. Anyone with a valid signed URL can use it until expiration.
{% endhint %}

## Supported CDN Resource types

MD5 Secure Token supports the following CDN Resource types:

| CDN Resource type | Availability  | Signing scope           |
| ----------------- | ------------- | ----------------------- |
| Small CDN         | Not supported | —                       |
| Large CDN         | Supported     | Individual file path    |
| Large Streaming   | Supported     | Directory path          |
| Streaming / VOD   | Supported     | Individual request path |
| Dynamic CDN       | Not supported | —                       |

For Large Streaming, a directory signature can cover a playlist and segments within that directory.

## Understand platform-specific signing

The signature format depends on the CDN Resource type.

| CDN Resource type | Signed string                  | Signature parameter | Expiration parameter |
| ----------------- | ------------------------------ | ------------------- | -------------------- |
| Large CDN         | `KEY + PATH + EXPIRATION`      | `vsignature`        | `vexpiration`        |
| Large Streaming   | `KEY + DIRECTORY + EXPIRATION` | `vsignature`        | `vexpiration`        |
| Streaming / VOD   | `PATH + KEY + EXPIRATION`      | `sign`              | `expire`             |

Concatenate the values without separators.

All three variants use a lowercase hexadecimal MD5 digest.

{% hint style="warning" %}
Do not use the same signing formula for every CDN Resource type. A valid signature for one platform may fail on another.
{% endhint %}

## Configure MD5 Secure Token

Use the [Medianova Control Panel](https://cloud.medianova.com) to configure MD5 Secure Token for a supported CDN Resource.

{% stepper %}
{% step %}

### Select a CDN Resource

Open the CDN Resource you want to protect in the [Medianova Control Panel](https://cloud.medianova.com).
{% endstep %}

{% step %}

### Open Security settings

Navigate to **Security → General**.
{% endstep %}

{% step %}

### Enable Security Token

Enable **Security Token**.
{% endstep %}

{% step %}

### Select MD5 Secure Token

Choose **MD5 Secure Token** from **Token Type**.

<figure><img src="https://542970813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtK7oIwmhUHdEJcaH4Hx8%2Fuploads%2Fr5h4jNQgYEFjnK3fdXu3%2Fimage.png?alt=media&amp;token=026638bf-b4d5-4a97-948d-cdb4a7c61a70" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Configure the Token Key

Enter a secret key in **Token Key**.

Store the same key securely in your application backend.
{% endstep %}

{% step %}

### Save the configuration

Click **Save** to apply your settings.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
Keep the Token Key confidential. Changing the key invalidates URLs generated with the previous key.
{% endhint %}

## Generate signed URLs for Large CDN

Large CDN uses the full file path and the following URL parameters:

<table><thead><tr><th width="357">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>vsignature</code></td><td>Lowercase hexadecimal MD5 signature.</td></tr><tr><td><code>vexpiration</code></td><td>Expiration time as a Unix timestamp in seconds.</td></tr></tbody></table>

### Calculate the signature

Use this formula:

```
vsignature = hex(MD5(KEY + PATH + EXPIRATION))
```

Where:

* `KEY` is the configured Token Key.
* `PATH` is the requested file path.
* `EXPIRATION` is the Unix expiration timestamp.

The values must be concatenated without separators.

### Verify the Large CDN example

Use these test values:

| Input           | Value                   |
| --------------- | ----------------------- |
| Token Key       | `ExampleKey2026`        |
| File path       | `/videos/sample.mp4`    |
| Expiration      | `1798761600`            |
| Expiration date | 2027-01-01 00:00:00 UTC |

The signed string is:

```
ExampleKey2026/videos/sample.mp41798761600
```

The expected signature is:

```
c71513f850a30b710c396fe98ed989d6
```

The resulting URL is:

```
https://cdn.example.com/videos/sample.mp4?vsignature=c71513f850a30b710c396fe98ed989d6&vexpiration=1798761600
```

The signature applies to the specified file path.

A different file path requires a new signature.

## Generate signed URLs for Large Streaming

Large Streaming uses the directory path instead of the full file path.

This allows a token to cover a playlist and segments within the same directory.

### Calculate the signature

Use this formula:

```
vsignature = hex(MD5(KEY + DIRECTORY + EXPIRATION))
```

Where:

* `KEY` is the configured Token Key.
* `DIRECTORY` is the requested content's directory path.
* `EXPIRATION` is the Unix expiration timestamp.

Use the same `vsignature` and `vexpiration` parameters as Large CDN.

### Verify the Large Streaming example

Use these values:

| Input           | Value                         |
| --------------- | ----------------------------- |
| Token Key       | `ExampleKey2026`              |
| File path       | `/live/stream1/playlist.m3u8` |
| Directory       | `/live/stream1/`              |
| Expiration      | `1798761600`                  |
| Expiration date | 2027-01-01 00:00:00 UTC       |

The signed string is:

```
ExampleKey2026/live/stream1/1798761600
```

The expected signature is:

```
4f2f889566049789d19e2356ba71c381
```

The resulting URL is:

```
https://cdn.example.com/live/stream1/playlist.m3u8?vsignature=4f2f889566049789d19e2356ba71c381&vexpiration=1798761600
```

The same signature can authorize content within the signed directory until expiration.

### Handle Large Streaming directories

Sign the directory containing the requested file.

For example:

| Requested path                | Signed directory |
| ----------------------------- | ---------------- |
| `/live/stream1/playlist.m3u8` | `/live/stream1/` |
| `/live/stream1/segment001.ts` | `/live/stream1/` |
| `/live/stream2/playlist.m3u8` | `/live/stream2/` |

The existing technical implementation also defines special handling for `/keyframes/` path components.

For example:

```
Requested directory:
/live/keyframes/stream1/

Signed directory:
/live/stream1/
```

Remove the `/keyframes` component before calculating the signature.

## Generate signed URLs for Streaming / VOD

Streaming / VOD uses different parameter names and a different signing order.

<table><thead><tr><th width="316.5">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>sign</code></td><td>Lowercase hexadecimal MD5 signature.</td></tr><tr><td><code>expire</code></td><td>Expiration time as a Unix timestamp in seconds.</td></tr></tbody></table>

### Calculate the signature

Use this formula:

```
sign = hex(MD5(PATH + KEY + EXPIRATION))
```

Unlike Large CDN, the path appears before the Token Key.

### Verify the Streaming / VOD example

Use these values:

| Input           | Value                         |
| --------------- | ----------------------------- |
| Token Key       | `ExampleKey2026`              |
| File path       | `/live/stream1/playlist.m3u8` |
| Expiration      | `1798761600`                  |
| Expiration date | 2027-01-01 00:00:00 UTC       |

The signed string is:

```
/live/stream1/playlist.m3u8ExampleKey20261798761600
```

The expected signature is:

```
949e0eeee899c08f491363fa7213faee
```

The resulting URL is:

```
https://cdn.example.com/live/stream1/playlist.m3u8?sign=949e0eeee899c08f491363fa7213faee&expire=1798761600
```

{% hint style="warning" %}
Streaming / VOD uses `sign` and `expire`, not `vsignature` and `vexpiration`. The signed string also begins with the file path.
{% endhint %}

## Generate signed URLs with Python

The following example supports all three MD5 Secure Token signing formats.

It reads the Token Key from an environment variable and generates URLs valid for one hour.

```python
import hashlib
import os
import time
from urllib.parse import urlencode


def sign_url(
    base_url: str,
    path: str,
    key: str,
    ttl: int,
    platform: str,
) -> str:
    expiration = int(time.time()) + ttl

    if platform == "large":
        signed_data = f"{key}{path}{expiration}"
        signature_name = "vsignature"
        expiration_name = "vexpiration"

    elif platform == "large_streaming":
        directory = path[:path.rfind("/") + 1]

        # Normalize keyframes directories.
        directory = directory.replace(
            "/keyframes/",
            "/",
        )

        signed_data = f"{key}{directory}{expiration}"
        signature_name = "vsignature"
        expiration_name = "vexpiration"

    elif platform == "streaming":
        signed_data = f"{path}{key}{expiration}"
        signature_name = "sign"
        expiration_name = "expire"

    else:
        raise ValueError("Unsupported platform.")

    signature = hashlib.md5(
        signed_data.encode("utf-8")
    ).hexdigest()

    query = urlencode({
        signature_name: signature,
        expiration_name: expiration,
    })

    return f"{base_url}{path}?{query}"


url = sign_url(
    base_url="https://cdn.example.com",
    path="/videos/sample.mp4",
    key=os.environ["MN_TOKEN_KEY"],
    ttl=3600,
    platform="large",
)

print(url)
```

Set `MN_TOKEN_KEY` to the Token Key configured in the Medianova Control Panel.

Replace the example hostname and file path with your actual values.

Set `platform` to one of the following:

* `large` for Large CDN.
* `large_streaming` for Large Streaming.
* `streaming` for Streaming / VOD.

The script generates a 32-character lowercase hexadecimal MD5 signature.

{% hint style="info" %}
Generate signed URLs on a trusted backend. Never expose the Token Key in browser scripts, mobile applications, or public repositories.
{% endhint %}

## Follow path signing rules

The signed path depends on the CDN Resource type.

| Rule                  | Large CDN      | Large Streaming   | Streaming / VOD           |
| --------------------- | -------------- | ----------------- | ------------------------- |
| Signed path           | Full file path | Directory path    | Full request path         |
| Include hostname      | No             | No                | No                        |
| Include query string  | No             | No                | No                        |
| Path case-sensitive   | Yes            | Yes               | Yes                       |
| Encoded path handling | Decoded path   | Decoded directory | Path as it appears in URL |

### Handle encoded paths

Large CDN and Large Streaming use decoded paths when generating signatures.

For example:

```
Requested path:
/videos/my%20file.mp4

Signed path on Large CDN:
/videos/my file.mp4
```

Streaming / VOD signs the path as it appears in the URL.

For example:

```
Requested path:
/videos/my%20file.mp4

Signed path on Streaming / VOD:
/videos/my%20file.mp4
```

Do not change the signed path after generating the signature.

{% hint style="warning" %}
URL encoding differences can cause signature mismatches. Use the correct path representation for the selected CDN Resource type.
{% endhint %}

## Manage token expiration

MD5 Secure Token uses a Unix timestamp in seconds to define when a URL expires.

The parameter name depends on the platform:

* `vexpiration` for Large CDN and Large Streaming.
* `expire` for Streaming / VOD.

Calculate the expiration using the current Unix time and the required validity period.

For example:

```
EXPIRATION = CURRENT_UNIX_TIME + 3600
```

This creates a token valid for one hour.

MD5 Secure Token compares expiration timestamps using UTC.

The **Token Timezone** setting does not affect this token type.

### Account for streaming duration

Streaming sessions may generate multiple playlist and segment requests.

Each request requires a valid token.

Use an expiration period long enough for the expected viewing session, or implement a token renewal mechanism.

{% hint style="warning" %}
Expired MD5 Secure Token URLs return HTTP 403 Forbidden, not HTTP 410 Gone. This differs from several other Security Token types.
{% endhint %}

## Deploy MD5 Secure Token safely

Prepare your application before enabling token validation.

{% stepper %}
{% step %}

### Generate a Token Key

Create a secure key and store it in your application's secret management system.
{% endstep %}

{% step %}

### Implement platform-specific signing

Generate signatures using the formula required by your CDN Resource type.
{% endstep %}

{% step %}

### Validate the signing implementation

Compare your generated signatures with the worked examples on this page.
{% endstep %}

{% step %}

### Deploy signed URLs

Update your application or streaming player to use signed URLs.
{% endstep %}

{% step %}

### Configure public path exceptions

Create Page Rules for content that must remain publicly accessible, where supported.
{% endstep %}

{% step %}

### Enable MD5 Secure Token

Apply the prepared configuration in the Medianova Control Panel.
{% endstep %}

{% step %}

### Verify protected requests

Test valid, invalid, expired, and unsigned URLs.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
Enabling Security Token can immediately reject unsigned requests. Deploy signed URLs before enforcing token validation.
{% endhint %}

## Validate protected requests

The existing MD5 Secure Token technical guide documents these responses:

| Condition                      | Expected response                    |
| ------------------------------ | ------------------------------------ |
| Valid signature and expiration | Request proceeds to content delivery |
| Missing signature              | 403 Forbidden                        |
| Invalid signature              | 403 Forbidden                        |
| Expired token                  | 403 Forbidden                        |
| Incorrect parameter names      | 403 Forbidden                        |

A valid token does not guarantee HTTP 200. The final response also depends on content availability and other CDN settings.

## Troubleshoot MD5 Secure Token

### HTTP 403 Forbidden

HTTP 403 can indicate a missing, invalid, or expired token.

Check the following:

* The URL contains the correct signature and expiration parameters.
* The Token Key matches the configured key.
* The signing formula matches the CDN Resource type.
* The signature contains 32 lowercase hexadecimal characters.
* The expiration timestamp is still valid.
* The signed path matches the requested path.
* The application uses the correct path encoding.
* The URL has not been modified or redirected to another path.

Compare your output with the expected signatures:

| CDN Resource type | Expected signature                 |
| ----------------- | ---------------------------------- |
| Large CDN         | `c71513f850a30b710c396fe98ed989d6` |
| Large Streaming   | `4f2f889566049789d19e2356ba71c381` |
| Streaming / VOD   | `949e0eeee899c08f491363fa7213faee` |

### A token works on Large CDN but fails on Streaming

The platforms use different signing orders and parameter names.

Large CDN uses:

```
MD5(KEY + PATH + EXPIRATION)
```

Streaming / VOD uses:

```
MD5(PATH + KEY + EXPIRATION)
```

Generate a new signature using the appropriate formula.

### A streaming playlist works but segments fail

Check whether the segment requests include valid token parameters.

For Large Streaming, verify the signed directory.

For Streaming / VOD, verify the exact path of each protected request.

Also check whether the token expires during playback.

### A token fails for a URL containing encoded characters

Check the path encoding rules for the selected platform.

Large CDN uses decoded paths.

Streaming / VOD signs the path as it appears in the URL.

### A previously valid URL stops working

Check the expiration timestamp and Token Key.

MD5 Secure Token returns HTTP 403 for expired URLs.

Generate a new signed URL if the previous token has expired.

## Security recommendations

* Store the Token Key in a secure backend environment.
* Use a separate signing implementation for each platform.
* Generate 32-character lowercase hexadecimal signatures.
* Use HTTPS when delivering protected content.
* Choose expiration periods appropriate for downloads and streaming sessions.
* Keep application clocks synchronized.
* Avoid exposing Token Keys in client-side code.
* Test signing behavior before enabling enforcement.

{% hint style="warning" %}
MD5 Secure Token provides signed URL validation but does not authenticate individual users. Use additional access controls when identity-based authorization is required.
{% endhint %}

## Related token types

For different access requirements, consider:

* [**Standard Secure Token**](https://clients.medianova.com/products/security/security-token/standard-secure-token.md)**:** Protect individual files using Base64URL-encoded MD5 signatures.
* [**Secure Token v2**](https://clients.medianova.com/products/security/security-token/secure-token-v2.md)**:** Protect directories or an entire CDN Resource.
* [**Streaming Secure Token**](https://clients.medianova.com/products/security/security-token/streaming-secure-token.md)**:** Generate signed URLs for streaming content.
* [**Streaming Secure Token – IP Lock**](https://clients.medianova.com/products/security/security-token/streaming-secure-token-ip-lock.md)**:** Bind streaming access to a viewer's IP address.

{% hint style="info" %}
For general feature configuration, refer to the [Security Token](https://clients.medianova.com/products/security/security-token.md) page.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://clients.medianova.com/products/security/security-token/md5-secure-token.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
