public boolean reverseTransformPacket ( RawPacket pkt ) { int seqNo = pkt . getSequenceNumber ( ) ; if ( ! seqNumSet ) { seqNumSet = true ; seqNum = seqNo ; } // Guess the SRTP index (48 bit), see rFC 3711, 3.3.1 // Stores the guessed roc in this.guessedROC long guessedIndex = guessIndex ( seqNo ) ; // Replay control if ( ! checkReplay ( seqNo , guessedIndex ) ) { return false ; } // Authenticate packet if ( policy . getAuthType ( ) != SRTPPolicy . NULL_AUTHENTICATION ) { int tagLength = policy . getAuthTagLength ( ) ; // get original authentication and store in tempStore pkt . readRegionToBuff ( pkt . getLength ( ) - tagLength , tagLength , tempStore ) ; pkt . shrink ( tagLength ) ; // save computed authentication in tagStore authenticatePacketHMCSHA1 ( pkt , guessedROC ) ; for ( int i = 0 ; i < tagLength ; i ++ ) { if ( ( tempStore [ i ] & 0xff ) != ( tagStore [ i ] & 0xff ) ) { return false ; } } } // Decrypt packet switch ( policy . getEncType ( ) ) { case SRTPPolicy . AESCM_ENCRYPTION : case SRTPPolicy . TWOFISH_ENCRYPTION : // using Counter Mode encryption processPacketAESCM ( pkt ) ; break ; case SRTPPolicy . AESF8_ENCRYPTION : case SRTPPolicy . TWOFISHF8_ENCRYPTION : // using F8 Mode encryption processPacketAESF8 ( pkt ) ; break ; default : return false ; } update ( seqNo , guessedIndex ) ; return true ; }
Transform a SRTP packet into a RTP packet . This method is called when a SRTP packet is received .