UserSig is a security signature designed by Tencent Cloud to prevent attackers from accessing your Tencent Cloud account.SDKAppID, UserID, and UserSig in the initialization or login function of the corresponding SDK.SDKAppID is used to identify your application, and UserID your user. UserSig is a security signature calculated based on the two parameters using the HMAC SHA256 encryption algorithm. Attackers cannot use your Tencent Cloud traffic without authorization as long as they cannot forge a UserSig.UserSig is calculated. Basically, it involves hashing crucial information including SDKAppID, UserID, and ExpireTime.// UserSig formula, in which `secretkey` is the key used to calculate UserSigusersig = hmacsha256(secretkey, (userid + sdkappid + currtime + expire +base64(userid + sdkappid + currtime + expire)))
currtime is the current system time and expire the expiration time of the signature.UserSig.GenerateTestUserSig in the MLVB SDK sample code. Set the three member variables of SDKAPPID, EXPIRETIME, and SECRETKEY, and call genTestUserSig() to generate a UserSig and get started quickly with the SDK.SECRETKEY of the client code (especially on the web) may be easily decompiled and reversed. If your key is leaked, attackers can steal your Tencent Cloud traffic.UserSig calculation code on your project server so that your application can request from your server a UserSig that is calculated whenever one is needed.UserSig offers the utmost protection against key leakage, for it is more difficult to hack a server than it is to reverse engineer an application. See below for the specific method.UserSig from your server.UserSig based on the SDKAppID and UserID. The calculation source code is provided above.UserSig to your application.UserSig to the SDK through a specific API.SDKAppID + UserID + UserSig to the Tencent Cloud server for verification.UserSig.UserSig is valid, real time audio/video services will be provided to the TRTC SDK.
UserSig calculation source code in multiple languages.Programming Language | Signature Algorithm | Key Function | Download Link |
Java | HMAC-SHA256 | ||
GO | HMAC-SHA256 | ||
PHP | HMAC-SHA256 | ||
Nodejs | HMAC-SHA256 | ||
Python | HMAC-SHA256 | ||
C# | HMAC-SHA256 |
Feedback