tencent cloud

Header Information
Last updated: 2025-09-23 17:55:32
Header Information
Last updated: 2025-09-23 17:55:32
Note:
Supported only on public cloud.

Common request header information

Request header
Description
Note
Example
Content-Type
application/json
-
-
TC-Timestamp
Timestamp in milliseconds.
This field is provided by Super App as a Service (SAS).
1735293931220
TC-Signature
Signature string.
This field is provided by Super App as a Service (SAS) and is a hex-encoded string based on AES ECB encryption of the TC-Timestamp value string. The secret key is referenced in the Configuration Management .
xxx

Signature algorithm

Advanced Encryption Standard (AES)

Example

func TestGenerateSignature(t *testing.T) {
// test data
secretKey := "MBMIvsoijBSTqLPoCHYinLXKvlaCKfev"
timestamp := fmt.Sprintf("%v", time.Now().UnixMilli())
encryptBytes, err := EncryptECB([]byte(timestamp), []byte(secretKey))
if err != nil {
fmt.Println(err)
}
signature := hex.EncodeToString(encryptBytes)
fmt.Println(signature)
}

func EncryptECB(plaintext, key []byte) ([]byte, error) {

block, err := aes.NewCipher(key)
if err != nil {
return nil, errors.Errorf(fmt.Sprintf("Error: NewCipher(%d bytes) = %s", len(key), err))
}
padded := PKCS7Padding(plaintext, block.BlockSize())
ciphertext := make([]byte, len(padded))

for bs, be := 0, block.BlockSize(); bs < len(padded); bs, be = bs+block.BlockSize(), be+block.BlockSize() {
block.Encrypt(ciphertext[bs:be], padded[bs:be])
}

return ciphertext, nil
}
func PKCS7Padding(ciphertext []byte, blockSize int) []byte {
padding := blockSize - len(ciphertext)%blockSize
padtext := bytes.Repeat([]byte{byte(padding)}, padding)
return append(ciphertext, padtext...)
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback