libsrtp 编译测试方法

本文介绍如何从源码编译libsrtp,并提供了一种测试方法来验证其功能。包括下载源码、编译步骤及使用示例,演示了如何模拟发送端和接收端进行交互测试。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值