tencent cloud

Game Multimedia Engine

製品アップデート情報
製品紹介
製品概要
優位性のある特徴
製品機能
ユースケース
セキュリティコンプライアンス認証
初心者ガイド
SDKダウンロードガイド
製品機能体験
基本機能Demo
シーン化体験
コンソールガイド
使用量の表示
サービスの有効化
クイックスタート
Quick Integration of SDK
Quick Integration of Sample Project
基本機能開発ガイド
Authentication Key
リアルタイム音声ロール設定
音質設定
拡張機能開発ガイド
サーバー側のレコーディング
レンジボイス
3Dサウンド
効果音と伴奏
ネットワークオーディオストリーム転送ルーティング
カスタムメッセージチャネル
社内ファイアーフォール制限への対応について
Language Parameter Reference List
GMEルーム管理機能の導入
クライアントAPI
SDK for Unity
SDK for Unreal Engine
Cocos2D SDK
SDK for Windows
SDK for iOS
SDK for Android
SDK for macOS
H5 SDK
Electron SDK
SDK for Flutter
SDK Version Upgrade Guide
エラーコード
Toolchain
Server APIs
History
Introduction
API Category
Usage APIs
Recording APIs
Making API Requests
Voice Chat APIs
Application APIs
Data Types
Error Codes
よくある質問
製品機能質問
問題解決ガイド
課金について
Sample Projectの使用上の問題
一般的な質問
認証について
リアルタイム音声ルーム参加失敗について
リアルタイム音声利用時に音声が聞こえない問題とオーディオ関連について
ネットワークについて
ボイス・ツー・テキスト変換について
プロジェクトエクスポートについて
Service Agreement
Service Level Agreement
お問い合わせ
用語集
GME ポリシー
データ処理とセキュリティ契約
プライバシーポリシー

Authentication Key

PDF
フォーカスモード
フォントサイズ
最終更新日: 2024-01-18 11:56:22
This document describes the authentication key for all platforms to help you integrate and debug GME.

Backend Deployment of Voice Key

GME provides authentication keys for voice chat and offline voice. This document describes the backend deployment scheme. The generation process of the signature used for authentication involves plaintext, secret key and algorithm.

Plaintext

The plaintext is the concatenation of the following fields in endian byte order:
Field
Type/Length
Description
cVer
unsigned char(1)
Version number. Enter 1.
wOpenIDLen
unsigned short(2)
User account length
strOpenID
string
User account's characters
dwSdkAppid
unsigned short(4)
SDKappid of the developer
dwReserved1
unsigned int(4)
Enter 0.
dwExpTime
unsigned int(4)
Expiration time (current time + validity period) in seconds. 300 is recommended.
dwReserved2
unsigned int(4)
Enter -1 or 0xFFFFFFFF.
dwReserved3
unsigned int(4)
Enter 0.
wRoomIDLen
unsigned short(2)
Length of the ID of the room to enter. Enter 0 for the voice messaging service.
strRoomID
string
Characters of the ID of the room to enter

Key

Get the relevant permission key in the GME console.

Algorithm

The Tiny Encryption Algorithm (TEA) symmetric algorithm is used. Generally, we recommend that you use the client deployment scheme in the initial stage, which later can be optimized for deployment on the game application's backend.
Scheme
Pros
Cons
Backend deployment
High security
Backend development and joint testing required
Client deployment
Quick integration
Low security

Backend Deployment

The encrypted string generated on the backend is sent to the client and used for the following scenario: When the EnterRoom API is called for entering a room, the encrypted string will be transferred to the authBuffer field in the parameters for room entering.

Algorithm Encryption Details

Key: Authentication key of APPID.
Encryption algorithm: TEA.
Note:
Change of the key in the console takes effect within 15 minutes to 1 hour. We recommend that you not change it frequently.

Encryption method

1. Reorganize the numbers in the plaintext in endian order.
2. Concatenate the plaintext fields into a string in the sequence how they are declared.
3. Encrypt the concatenated string with TEA. The string output by the symmetry_encrypt function is the permission encryption string.
Note:
Do not convert a binary string into a hexadecimal one.

Sample code

Taking C++ as an example, below is the sample code of the authentication key:
unsigned char pInBuf[512]={0};
xel::byte_writer bw(pInBuf, sizeof(pInBuf));

char cVer = 1;
unsigned short wOpenIDLen = (unsigned short)strlen((const char *)strOpenID);
if (wOpenIDLen > 127) wOpenIDLen = 127;
unsigned short wRoomIDLen = (unsigned short)strlen((const char *)strRoomID);
if (wRoomIDLen > 127) wRoomIDLen = 127;

bw.write_byte(cVer);
bw.write_int16(wOpenIDLen);
bw.write_bytes(strOpenID, wOpenIDLen);
bw.write_int32(dwSdkAppId);
bw.write_int32(0 /*dwRoomID*/);
bw.write_int32(expTime);
bw.write_int32(nAuthBits);
bw.write_int32(0 /*dwAccountType*/);
bw.write_int16(wRoomIDLen);
bw.write_bytes(strRoomID, wRoomIDLen);

int pInLen = bw.bytes_write();

unsigned char pEncryptOutBuf[512] = { 0 };
int iEncrptyLen = 0;

symmetry_encrypt((const unsigned char*)pInBuf, pInLen, (const unsigned char*)key, (unsigned char*)pEncryptOutBuf, &iEncrptyLen);
You can also download the sample code in Java and Go here.

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック