字段描述 | 类型/长度 | 值定义/备注 |
cVer | unsigned char(1) | 版本号,填写数值:1 |
wOpenIDLen | unsigned short(2) | 用户的帐号长度 |
strOpenID | string | 用户的帐号字符 |
dwSdkAppid | unsigned short(4) | 开发者的 SDKappid |
dwReserved1 | unsigned int(4) | 填写数值:0 |
dwExpTime | unsigned int(4) | 过期时刻(当前时间+有效期[单位:秒,建议300秒]) |
dwReserved2 | unsigned int(4) | 填写数值:-1或者 0xFFFFFFFF |
dwReserved3 | unsigned int(4) | 填写数值:0 |
wRoomIDLen | unsigned short(2) | 用户要进入的房间号码长度,如果是离线语音服务,请填写0 |
strRoomID | string | 用户要进入的房间号码字符 |
方案 | 优点 | 缺点 |
后台部署 | 安全性高 | 需要后台开发联调 |
客户端部署 | 接入快速 | 安全性低 |
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);
本页内容是否解决了您的问题?