Request signing
Request Signing is an access token method that adds another level of security where the client generates a unique signature that identifies the request temporally to ensure that the request is from the requesting user, using a secret key that is never broadcast over the wire. Tyk can apply either the symmetric Hash-Based Message Authentication Code (HMAC) or asymmetric Rivest-Shamir-Adleman (RSA) algorithms when generating the signature for a request to be sent upstream. For HMAC, Tyk supports different options for the hash length. The following algorithms are supported:| Hashing algorithm | Tyk identifier used in API definition | 
|---|---|
| HMAC SHA1 | hmac-sha1 | 
| HMAC SHA256 | hmac-sha256 | 
| HMAC SHA384 | hmac-sha384 | 
| HMAC SHA512 | hmac-sha512 | 
| RSA SHA256 | rsa-sha256 | 
Date header in the request that is to be proxied to the upstream, Tyk will add one.
Configuring Request Signing in the API definition
Upstream Authentication is configured per-API in the Tyk Vendor Extension by adding the authentication section within theupstream section.
For Request Signing, you must configure upstream.authentication.upstreamRequestSigning, providing the following settings:
- the signatureHeaderin which the signature should be sent (typicallyAuthorization)
- the algorithmto be used to generate the signature (from the table above)
- the secretto be used in the encryption operation
- optional headersthat Tyk should include in the string that is encrypted to generate the signature
- the keyIdthat the upstream will use to identify Tyk as the client (used for HMAC encryption)
- the certificateIdthat the upstream will use to identify Tyk as the client (used for RSA encryption)
Configuring Request Signing with Tyk Operator
When using Tyk Operator, thecertificateId and secret are encapsulated in Kubernetes references:
- certificateRef: references a Secret containing the private and secret key.
- secretRef: references a Kubernetes Secret that holds the secret used in the encryption operation.
linenostart=1, hl_lines=["66-73"]}
upstreamRequestSigning field. It can be broken down as follows:
- upstreamRequestSigning: This defines the settings for Upstream Request Signing. in the example manifest, it configures Upstream Request Signing using the- bookingAPI.- certificateRef: References a Secret containing the private and secret key for signing client API requests. This should be used if- secretRefis not specified.
- secretRef: References a Kubernetes Secret that holds the secret key for signing client requests.
- algorithm: Specifies the algorithm used for signing.- For secretRef, supported algorithms include:hmac-sha1,hmac-sha256,hmac-sha384, andhmac-sha512.
- For certificateRef, the required algorithm isrsa-sha256.
 
- For 
- keyId: A user-defined key assumed to be available on the upstream service. This is used in the- SignatureHeaderand should be included when using- certificateRef. It is required when using the RSA algorithm.