tencent cloud

Feedback

Authentication Method C

Last updated: 2024-08-14 19:04:36

    Format of Authentication URL

    http://Hostname/md5hash/timestamp/Filename

    Parameter Description

    Field
    Description
    Hostname
    Site acceleration domain name.
    Path
    Resource access path, which must start with / during authentication.
    timestamp
    A Unix timestamp in the hexadecimal format (the total number of seconds that have passed since 00:00:00, January 1, 1970 regardless of the time zone)
    md5hash
    A string containing 32 characters calculated based on the MD5 algorithm:
    Algorithm: MD5 (key + Path + timestamp). Note: During calculation, the hexadecimal number identifier 0x of the hexadecimal timestamp must be filtered out.
    Authentication logic: If the request has not expired, the node will compare this string value with the md5hash value carried in the request URL. If the values are the same, the request will pass the authentication, and a response will be made to the request; if the values are different, the authentication will fail, and 403 will be returned.

    Configuration Example

    Assuming authentication method C is used for the requested URL https://www.example.com/foo.jpg, the configuration is as follows:
    

    Getting Authentication Parameters

    Path: /foo.jpg.
    timestamp: The time when the server generates the authentication URL is 15:43:06, July 15, 2024 (UTC+8), the hexadecimal (Unix timestamp) value of which is 6694d30a.
    Key: DvYmqE81E1F9R791H6lmht.
    md5hash: MD5 (key + Path + timestamp) = MD5 (DvYmqE81E1F9R791H6lmht/foo.jpg6694d30a) = 6688749e8906a726c12fe1be3aacd016.

    Authentication URL Generated by a Client Request

    https://www.example.com/6688749e8906a726c12fe1be3aacd016/6694d30a/foo.jpg.

    Node Authentication

    When the node server receives a client request via the encrypted URL, it will parse the timestamp parameter in the URL, and compare the sum of it and the configured validity period of ''1 second'' with the current time:
    1. If the current time is after the ''timestamp + validity period'' time, it indicates that the request has expired, and 403 will be returned directly. If the current time is before the ''timestamp + validity period'' time, it indicates that the request has not expired, and the node server will go to step 2.
    2. The node server calculates the md5hash value based on the obtained authentication parameters and compares it with the md5hash value carried in the request URL. If the values are the same, the request will pass the authentication, and a response will be made to the request; if the values are different, the authentication will fail, and 403 will be returned.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support