secure_token_encrypt_uri_hash_size

The `secure_token_encrypt_uri_hash_size` directive specifies the size of the hash used for encrypting URIs in the secure token module.

Syntaxsecure_token_encrypt_uri_hash_size size;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The secure_token_encrypt_uri_hash_size directive is utilized within the Secure Token module for NGINX, allowing administrators to define the size of the hash generated for encrypting URIs. This configuration is critical as it helps in controlling how secure the encrypted tokens are when they are generated. The directive can be applied in three contexts: http, server, and location, offering flexibility in how encryption settings are implemented based on the desired scope of application.

When the secure_token_encrypt_uri_hash_size is configured, the module utilizes the specified size to determine how many bits should be used in the resultant hash. This hash is essential for maintaining the integrity and authenticity of URIs, especially in environments where tokens are used for authenticating requests to media resources on CDNs such as Akamai or CloudFront. A larger hash size provides greater security at the cost of performance, while a smaller size may improve performance but at the risk of potential hash collisions, which could undermine security.

It is important to note that the size should be adequate enough to prevent any collisions and ensure that the tokens are sufficiently unique for each request. Administrators should therefore consider the hash size based not only on security requirements but also on application performance demands.

Config Example

secure_token_encrypt_uri_hash_size 256;

Using a hash size too small may lead to security vulnerabilities due to hash collisions.

Ensure that the hash size aligns with the requirements of the CDN service being used.

← Back to all directives