Hi Benny, here is the code I used to encrypt the packets using RC4 algorithm: typedef unsigned char UCHAR; UCHAR S[256], i, j, t; // i and j are counters void init(const char *key, int keylen) { int keypos = 0, x; UCHAR K[256]; for( x=0; x<256; ++x ) { S[x] = x; K[x] = key[keypos++]; if( keypos >= keylen ) keypos=0; } for( j=x=0; x<256; ++x ) { j += S[x] + K[x]; t = S[x]; S[x] = S[j]; S[j] = t; } i = j = 0; } // used by the encryption or decryption function // the value returned, had to be XORed with the plaintext or the // ciphertext to encrypt or decrypt. UCHAR next_rand() { ++i; j += S[i]; t = S[i]; S[i] = S[j]; S[j] = t; t = S[i] + S[j]; return S[t]; } void encrypt_decrypt(char *in,char *out,char*key){ int ks=strlen(key); int i=0; int size=strlen(in); init(key,ks); for(i=0;i<size;i++){ char c=out[i]; out[i]=((UCHAR)c) ^ next_rand(); //printf("%c",out[i]); } } Sincerely, Anass Kartit -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20070928/439a9abf/attachment.html