/**
         * Perform Counter Mode AES encryption / decryption
         *
         * @param pkt
         *            the RTP packet to be encrypted / decrypted
         */
        public void ProcessPacketAESCM(RawPacket pkt)
        {
            long ssrc  = pkt.GetSSRC();
            int  seqNo = pkt.GetSequenceNumber();

#pragma warning disable CS0675 // Bitwise-or operator used on a sign-extended operand
            long index = ((long)roc << 16) | seqNo;
#pragma warning restore CS0675 // Bitwise-or operator used on a sign-extended operand

            ivStore[0] = saltKey[0];
            ivStore[1] = saltKey[1];
            ivStore[2] = saltKey[2];
            ivStore[3] = saltKey[3];

            int i;
            for (i = 4; i < 8; i++)
            {
                ivStore[i] = (byte)((0xFF & (ssrc >> ((7 - i) * 8))) ^ this.saltKey[i]);
            }

            for (i = 8; i < 14; i++)
            {
                ivStore[i] = (byte)((0xFF & (byte)(index >> ((13 - i) * 8))) ^ this.saltKey[i]);
            }

            ivStore[14] = ivStore[15] = 0;

            int payloadOffset = pkt.GetHeaderLength();
            int payloadLength = pkt.GetPayloadLength();

            cipherCtr.Process(cipher, pkt.GetBuffer(), payloadOffset, payloadLength, ivStore);
        }
        /**
         * Perform F8 Mode AES encryption / decryption
         *
         * @param pkt
         *            the RTP packet to be encrypted / decrypted
         */
        public void ProcessPacketAESF8(RawPacket pkt)
        {
            // 11 bytes of the RTP header are the 11 bytes of the iv
            // the first byte of the RTP header is not used.
            MemoryStream buf = pkt.GetBuffer();

            buf.Read(ivStore, (int)buf.Position, 12);
            ivStore[0] = 0;

            // set the ROC in network order into IV
            ivStore[12] = (byte)(this.roc >> 24);
            ivStore[13] = (byte)(this.roc >> 16);
            ivStore[14] = (byte)(this.roc >> 8);
            ivStore[15] = (byte)this.roc;

            int payloadOffset = pkt.GetHeaderLength();
            int payloadLength = pkt.GetPayloadLength();

            SrtpCipherF8.Process(cipher, pkt.GetBuffer(), payloadOffset, payloadLength, ivStore, cipherF8);
        }