|
你好,我使用V5.2客户端的c#版demo,开启加解密功能,可以实现本地音视频数据的加密,对于接收方,可以对加密音频数据解密,但对加密视频数据并未调用该函数无法实现解密,求解~
加解密代码如下- #region 数据加解密
- private void Data_EncDec(int dwUserId, int dwFlags, IntPtr lpInBuf, int dwInSize,
- IntPtr lpOutBuf, ref int lpOutSize, int lpUserValue)
- {
- Console.WriteLine(dwFlags);
- if ((dwFlags & AnyChatCoreSDK.BRAC_DATAENCDEC_FLAGS_ENCMODE) != 0)
- {
- if ((dwFlags & AnyChatCoreSDK.BRAC_DATAENCDEC_FLAGS_AUDIO) != 0)
- {
- //音频
- string MingAudio_InBufData = Marshal.PtrToStringUni(lpInBuf);//格式转换
- byte[] MingAudio_Buffer = Encoding.Unicode.GetBytes(MingAudio_InBufData);
- //加密算法
- byte[] outarry = MingAudio_Buffer;
- Marshal.Copy(outarry, 0, lpOutBuf, outarry.Length);
- lpOutSize = outarry.Length;
- }
- else if ((dwFlags & AnyChatCoreSDK.BRAC_DATAENCDEC_FLAGS_VIDEO) != 0)
- {
- //视频
- string MingVideo_InBufData = Marshal.PtrToStringUni(lpInBuf);//格式转换
- byte[] MingVideo_Buffer = Encoding.Unicode.GetBytes(MingVideo_InBufData);
- //加密算法
- byte[] outarry = MingVideo_Buffer;
- Marshal.Copy(outarry, 0, lpOutBuf, outarry.Length);
- lpOutSize = outarry.Length;
- }
- }
- else if ((dwFlags & AnyChatCoreSDK.BRAC_DATAENCDEC_FLAGS_DECMODE) != 0)
- {
- if ((dwFlags & AnyChatCoreSDK.BRAC_DATAENCDEC_FLAGS_AUDIO) != 0)
- {
- //音频
- string MiAudio_InBufData = Marshal.PtrToStringUni(lpInBuf);//格式转换
- byte[] MiAudio_Buffer = Encoding.Unicode.GetBytes(MiAudio_InBufData);
- //解密算法
- byte[] outarry = MiAudio_Buffer;
- Marshal.Copy(outarry, 0, lpOutBuf, outarry.Length);
- lpOutSize = outarry.Length;
- }
- else if ((dwFlags & AnyChatCoreSDK.BRAC_DATAENCDEC_FLAGS_VIDEO) != 0)
- {
- //视频
- string MiVideo_InBufData = Marshal.PtrToStringUni(lpInBuf);//格式转换
- byte[] MiVideo_Buffer = Encoding.Unicode.GetBytes(MiVideo_InBufData);
- //解密算法
- byte[] outarry = MiVideo_Buffer;
- Marshal.Copy(outarry, 0, lpOutBuf, outarry.Length);
- lpOutSize = outarry.Length;
- }
- }
- }
- #endregion
复制代码 |
|