As an optional security feature, the TeamSpeak SDK offers to restrict access of clients to specific channels by using a salt and hash mechanism. The motivation here is to enforce clients to use a specific identity, nickname and metadata when they connect to the TeamSpeak server.
In the server, a security salt is created over a clients unique data by calling ts3server_createSecuritySalt
. This created salt is then attached to a channel during channel creation or by editing existing channels by setting the channel variable CHANNEL_SECURITY_SALT
. When this channel variable is set, when a client enters the channel, the clients CLIENT_SECURITY_HASH
variable is checked against the clients data (unique id, optionally nickname and meta_data) using the salt. If the hash is not correct, the client is not allowed to enter the channel.
The clients hash value is calculated by the server calling ts3server_calculateSecurityHash
. This security hash has to be transmitted to the client by ways outside of the TeamSpeak SDK. The client will set the hash in its CLIENT_SECURITY_HASH
variable.
To create a security salt for the channel, call:
unsigned int ts3server_createSecuritySalt( | options, | |
salt, | ||
saltByteSize, | ||
securitySalt) ; |
int options
;void* salt
;int saltByteSize
;char** securitySalt
;options
Combination of (OR'ed)
SECURITY_SALT_CHECK_NICKNAME -> means nickname will be used in security hash SECURITY_SALT_CHECK_META_DATA -> means metadata will be used in security hash
salt
Pointer to random data. This should be good random data, like cryptographic random.
saltByteSize
Size of the random data. Larger is better.
securitySalt
Pointer that receives the salt. Needs to be freed.
To create a security hash for a client, call:
unsigned int ts3server_calculateSecurityHash( | securitySalt, | |
clientUniqueIdentifier, | ||
clientNickName, | ||
clientMetaData, | ||
securityHash) ; |
const char* securitySalt
;const char* clientUniqueIdentifier
;const char* clientNickName
;const char* clientMetaData
;char** securityHash
;securitySalt
The channels salt data.
clientUniqueIdentifier
Unique identifier of the client we want to calculate the hash for.
clientNickName
Clients nickname
clientMetaData
Clients meta data
securityHash
Pointer that receives the hash. Needs to be freed.