libsrtp 编译测试说明

来源:互联网 发布:麻瓜编程第一本python 编辑:程序博客网 时间:2024/06/08 10:54

libsrtp 编译测试说明

libsrtp 是 SRTP(Secure Realtime Transport Protocol)  安全实时传输协议的开发包。

可以在https://github.com/cisco/libsrtp里下载源码进行编译。

1、  Linux环境源码下载

wget https://github.com/cisco/libsrtp/archive/master.zip


2、  Build过程

解压:unzip master.zip -> cd libsrtp-master -> ./configure -> make -> make runtest ->

 make install

按照此过程进行编译后,我们可以在libsrtp-master目录里看到生成的库libsrtp2.a 

3、  测试

针对该源码,其中test是可用的测试用例,因此我们可以做一个测试,test中的内容

cd test

./rtpw_test.sh

4、  如要模拟发送端和接收端,分别完成发送数据和接收数据,我们依然可以使用test中的用例。在Linux中使用如下命令:

Sender:

cd  test

         k=c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451(不固定)

         ./rtpw-s -k $k -e 128 -a 127.0.0.1 9999 

Receiver:

cd  test

         k=c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451(不固定)

         ./rtpw-r -k $k -e 128 -a 127.0.0.1 9999 

   可以看到发送端和接收端的交互的具体数据.

         https://github.com/cisco/libsrtp中有使用命令的说明,具体参数含义如下:

usage: ./rtpw[-d <debug>]* [-k <key> [-a][-e]] [-s | -r] dest_ip dest_port

or     ./rtpw -l

where  -a use messageauthentication

      -e <key size> use encryption (use 128 or 256 for key size)

      -g Use AES-GCM mode (must be used with -e)

      -t <tag size> Tag size to use in GCM mode (use 8 or 16)

      -k <key>  sets the srtpmaster key given in hexadecimal

      -b <key>  sets the srtpmaster key given in base64

      -s act as rtp sender

      -r act as rtp receiver

      -l list debug modules

      -d <debug> turn on debugging for module <debug>

遇到的问题:

       在执行该命令的过程如果报错,test/rtpw: couldn't open file words.txt,则我们的解决办法是使用 yum install words.noarch,安装words

原创粉丝点击