RTP Stream AES Encryption/Decryption of Audio in a one-on-one audio chat...

Hi Everyone,

I have been trying to implement one-on-one encrypted audio chat for sometime now. This is a small part of a bigger project, but I m stuck up wid ecryption of part of it for some days ...

I wud b writing my approach here .. please suggest me if I m doing something wrong .. I need to solve this asap ..

TRANSMITTER - Right now I am using AVTransmit2 example as I m just transmitting an audio file for the moment .. Hav done the capture part seperately .. wud b combining them once I solve encryption thing ...

So, MediaLocator = that of a local .wav file ...

I am writing only the necessary lines of code ..

TrackControl [] tracks = processor.getTrackControls();

ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);

processor.setContentDescriptor(cd);

for (int i = 0; i < tracks.length; i++) {

Format format = tracks.getFormat();

if (tracks.isEnabled()) {

if (format instanceof AudioFormat) {

Codec codec[] = {new com.ibm.media.codec.audio.g723.Packetizer() , new AESPlugIn()};

((com.ibm.media.codec.audio.g723.Packetizer)codec[0]).setPacketSize(48);

try {

tracks.setCodecChain(codec);

// AESPlugin is implemented as an Effect and contains the AES

// implementation in the process method

// After this comes the normal RTP Manager streaming part .. using

//PushBufferDataSource

EFFECT/ AES Encryption part -

As is evident I m doing encryption as an Effect Plug-In, adding it in the codec chain after the G723/rtp conversion of audio.

I am setting InputFormat and OutputFormat to AudioFormat.G723_RTP

and calling my main AES implementation Function in the process method, using inbuffer and outbuffer.

Result - Without AESPlugIn in the codec chain, everything works fine .. data is transmitted ...

With the AESPlugIn/Effect, the process method gets CALLED only for a few times(for 1 sec) and that too with the same inbuffer and outbuffer values.

Can somebody tell me what xactly these inbuffer and outbuffer values refer to ? Shud b the g723_rtp stream buffers...

I always get the following values for inbuffer and outbuffer respectively

com.sun.media.ExtBuffer@3eca90

com.sun.media.ExtBuffer@64dc11

I dont understand why I get the same values always ? Since I get the same inputbuffer .. I get the same encrypted buffer ...

-

Reciever - Till now I was using AVReceive2 example .. but have not added AESPlugIn .. probably if transmitting works properly .. I just have to add AESPlugIn in the codec chain .. although am not sure abt this ..

-

Please suggest me if I m doing something wrong/ if some1 has a better and efficient approach/if somebody has already implemented encryption plugin .. the code wud b of gr8 help ..

Waiting for replies,

Thanks in advance,

Gaurav

[2962 byte] By [gauravzherea] at [2007-11-26 19:39:42]
# 1

Hi,

Now, I am trying this encryption using RTPConnector.

Encrypting the buffer in the read and write methods, before sock.send()

and sock.receive() respectively.

Trasnsmitter(AVTransmit3.java) works fine in this case.

Receiver(AVReceive3.java ) has 2 problems -

1. It always receives the same input buffers .. for eg ..

[B@1c1ea29 ? why ?

Strangely, the decryption of this is always a different buffer ?

Does somebody know why "[B@" is always attached to the buffers ..

2. The eventlisteners ReceiveStreamListener, SessionListener, ControllerListener in the program AVReceive3.java are not invoked when i receive an encrypted stream.

has anybody faced these problems and know a solution ?

Please reply or mail at gaurav.chandwani@gmail.com

Waiting in anticipation,

Gaurav

gauravzherea at 2007-7-9 22:18:55 > top of Java-index,Security,Cryptography...
# 2

Hi,

I am using Kphone which is a SIP based VoIP phone....and working on voice encryption in kphone.

I am encrypting the input before sending to socket using AES and then decrypting it after receving....but i get a prob...

When I encrypt ,i get the mangled data but after decryption I am not getting the correct data..

I have checked the AES key along with the decryption code..there is no prob in it cause that works fine for text msgs...

For audio msgs what can be possible reasons for this prob.

Plz Reply

Thanks in advance

Ashwini

A

ashwinita at 2007-7-9 22:18:56 > top of Java-index,Security,Cryptography...
# 3
hey ashwin,decrypt it before receiving ... i did the same mistake :)sry 4 late reply ...regards,gaurav
gauravzherea at 2007-7-9 22:18:56 > top of Java-index,Security,Cryptography...
# 4

Hi gaurav,

thanks for ur reply...

i m sending data from 1 client to another..i.e from 1 computer to another..

so how can i get the buffer or packet before receiving on the other side...

its not possible to decrypt before receiving...

if possible can u send me ur code or only that file where u did decryption,

may b looking at it i'll get the soln..

my email id is: wish4ashu@gmail.com

thanks again,

ashwini

ashwinita at 2007-7-9 22:18:56 > top of Java-index,Security,Cryptography...
# 5
hi GouravI am facing the same problem. can u pleas send me the sample codei would be very grateful to you
swatika at 2007-7-9 22:18:56 > top of Java-index,Security,Cryptography...