Header | Description | Example |
TC-Timestamp | Timestamp in milliseconds. | 1735293931220 |
TC-Signature | Signature string. | xxx |
current := timeutils.GetCurrentTimestamp()Signature:=cryptoutils.InnerEncrypt(current,secret)func InnerEncrypt(data, secretKey string) (string, error) {aesKey := []byte(secretKey)block, err := aes.NewCipher(aesKey)if err != nil {return "", err}blockSize := block.BlockSize()origData := c.PKCS7Padding([]byte(data), blockSize)blockMode := cipher.NewCBCEncrypter(block, aesKey[:blockSize])encipheredData := make([]byte, len(origData))blockMode.CryptBlocks(encipheredData, origData)return hex.EncodeToString(encipheredData), nil}
Was this page helpful?