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

