qutecom注册到asterisk上,sip信令使用rc4加密方法

本文介绍了如何在qutecom与asterisk之间使用rc4加密算法来保护sip信令的安全。通过rc4加密防止 sip 信令在传输过程中的明文风险,确保信令不被运营商干扰。示例代码展示了在qutecom的发送端和asterisk接收端如何集成rc4加密和解密过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

qutecom 一个开源的voip客户端

asterisk 开源的ippbx

rc4加密算法简单,快速,据说是比DES算法快10倍。sip 信令本身就属于明文方式传输的,之所以要加密,是为了防止运营商的干扰,使用一个弱的加密算法,是要能防止串改就满足要求了。

rc4 算法可以google原来,用密钥来生成一个256长度的box, 然后box与明文异或操作得到密文,密文再次异或就恢复明文。

下面实现了 qutecom 到asterisk 信令的当向加密,反向的目前还没弄完,等完工了在来补充。

 

rc4.h

/*
 *RC4 functions for HTMLDOC.
 *
 *   Original code by Rob Earhart
 *   Copyright 1999 by Carnegie Mellon University, All Rights Reserved
 *
 *   Permission to use, copy, modify, and distribute this software and its
 *   documentation for any purpose and without fee is hereby granted,
 *   provided that the above copyright notice appear in all copies and that
 *   both that copyright notice and this permission notice appear in
 *   supporting documentation, and that the name of Carnegie Mellon
 *   University not be used in advertising or publicity pertaining to
 *   distribution of the software without specific, written prior
 *   permission.
 *
 *   CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
 *   THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 *   FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR
 *   ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 *   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 *   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 *   OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _RC4_H_
#  define _RC4_H_

#  ifdef __cplusplus
extern "C" {
#  endif /* __cplusplus */


/*
 * RC4 context...
 */

typedef struct
{
  unsigned char    sbox[256];    /* S boxes for encryption */
  int        i, j;        /* Current indices into S boxes */
} rc4_context_t;


/*
 * Prototypes...
 */

extern void    rc4_init(rc4_context_t *context, const unsigned char *key,
             unsigned keylen);
extern void    rc4_encrypt(rc4_context_t *context, const unsigned char *input,
 &

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值