public boolean reverseTransformPacket ( RawPacket pkt ) { boolean decrypt = false ; int tagLength = policy . getAuthTagLength ( ) ; int indexEflag = pkt . getSRTCPIndex ( tagLength ) ; if ( ( indexEflag & 0x80000000 ) == 0x80000000 ) { decrypt = true ; } int index = indexEflag & ~ 0x80000000 ; /* Replay control */ if ( ! checkReplay ( index ) ) { return false ; } /* Authenticate the packet */ if ( policy . getAuthType ( ) != SRTPPolicy . NULL_AUTHENTICATION ) { // get original authentication data and store in tempStore pkt . readRegionToBuff ( pkt . getLength ( ) - tagLength , tagLength , tempStore ) ; // Shrink packet to remove the authentication tag and index // because this is part of authenicated data pkt . shrink ( tagLength + 4 ) ; // compute, then save authentication in tagStore authenticatePacket ( pkt , indexEflag ) ; for ( int i = 0 ; i < tagLength ; i ++ ) { if ( ( tempStore [ i ] & 0xff ) == ( tagStore [ i ] & 0xff ) ) { continue ; } else { return false ; } } } if ( decrypt ) { /* Decrypt the packet using Counter Mode encryption */ if ( policy . getEncType ( ) == SRTPPolicy . AESCM_ENCRYPTION || policy . getEncType ( ) == SRTPPolicy . TWOFISH_ENCRYPTION ) { processPacketAESCM ( pkt , index ) ; } /* Decrypt the packet using F8 Mode encryption */ else if ( policy . getEncType ( ) == SRTPPolicy . AESF8_ENCRYPTION || policy . getEncType ( ) == SRTPPolicy . TWOFISHF8_ENCRYPTION ) { processPacketAESF8 ( pkt , index ) ; } } update ( index ) ; return true ; }
Transform a SRTCP packet into a RTCP packet . This method is called when a SRTCP packet was received .