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;
    }
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 ; if ( ! checkReplay ( index ) ) { return false ; } if ( policy . getAuthType ( ) != SRTPPolicy . NULL_AUTHENTICATION ) { pkt . readRegionToBuff ( pkt . getLength ( ) - tagLength , tagLength , tempStore ) ; pkt . shrink ( tagLength + 4 ) ; authenticatePacket ( pkt , indexEflag ) ; for ( int i = 0 ; i < tagLength ; i ++ ) { if ( ( tempStore [ i ] & 0xff ) == ( tagStore [ i ] & 0xff ) ) { continue ; } else { return false ; } } } if ( decrypt ) { if ( policy . getEncType ( ) == SRTPPolicy . AESCM_ENCRYPTION || policy . getEncType ( ) == SRTPPolicy . TWOFISH_ENCRYPTION ) { processPacketAESCM ( pkt , index ) ; } 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.

Operations done by the this operation include:
Authentication check, Packet replay check and decryption.

Both encryption and authentication functionality can be turned off
as long as the SRTPPolicy used in this SRTPCryptoContext requires no
encryption and no authentication. Then the packet will be sent out
untouched. However this is not encouraged. If no SRTCP feature is enabled,
then we shall not use SRTP TransformConnector. We should use the original
method (RTPManager managed transportation) instead.

@param pkt the received RTCP packet
@return true if the packet can be accepted
false if authentication or replay check failed