sipdroid数据加密失败 [英] sipdroid data encrypt failed

查看:256
本文介绍了sipdroid数据加密失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过使用反向字节顺序进行自定义sipdroid客户端。我认为让其他的VoIP客户端不能去code这些数据。

I want to make a custom sipdroid client by using reverse byte order. I think that makes other Voip clients cannot decode these data.

所以我读了SipDroid的code。我发现RTP数据都会这样说:
1. AudioRecord.read(originalPCM)
2.连接code(originalPCM,连接codedData)
3. rtp_socket.send(rtp_packet)//带连接codeDATA是rtp_packet的数据部分。

So I read the code of the SipDroid. I found RTP data goes this way: 1. AudioRecord.read(originalPCM) 2. encode(originalPCM, encodedData) 3. rtp_socket.send(rtp_packet) //the encodeData is rtp_packet's data part

和另一侧是:
1. rtp_receive(rtp_packet)
2.去code(EN codeDATA,PCMData)//带连接codeDATA是rtp_packet的数据部分
3. AudioTrack.write(PCMData)

And the other side is: 1. rtp_receive(rtp_packet) 2. decode(encodeData, PCMData) //the encodeData is rtp_packet's data part 3. AudioTrack.write(PCMData)

所以,我修改了SipdroidSocket类。在发送方法,我添加以下code开头。

So I modified the SipdroidSocket class. In send method, I add the following code at the beginning.

byte[] b = pack.getData();
reverse(b);
pack.setData(b);

和在接收方法的末尾添加以下code。

And add the following code at the end of the receive method.

    byte[] b = pack.getData();
    reverse(b);
    pack.setData(b);

我觉得这种方式,两个客户端可以照常工作。但它失败了。我不知道原因。请帮我找出原因。谢谢你。

I think in this way, the two client can work as usual. But it failed. And I don't know the reason. Please help me to find out why. Thanks.

推荐答案

除非你同时接到2,4,8个字节,则不应扭转孔缓冲区。
你应该根据数据如何对待数据的字节数2,4,8元素
分别存放。在code I看到这里是行不通的。
假设你有数据字节0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08的缓冲
存储为0x04030201-0x08070605 4字节的元件。
倒车孔缓冲区将产生0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01
这是错误的,因为你将最终0x05060708-0x04030201
如果颠倒一次一个元件(4字节)。
请注意,一个元件的大小取决于所述数值是如何被存储

You should not reverse the hole buffer unless you receive 2,4,8 bytes at a time. You should treat the data as elements of 2,4,8 bytes depending on how the data were stored. The code i see here will not work. suppose you have a buffer of data bytes 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 stored as 4 byte elements of 0x04030201-0x08070605. Reversing the hole buffer will produce 0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01 which is wrong because you will end up with 0x05060708-0x04030201 If you reverse one element(4 bytes) at a time. Keep in mind that the size of an element depends on how the values were stored

这篇关于sipdroid数据加密失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆