Next() public method

public Next ( AESType t ) : AESEngine
t AESType
return AESEngine
Esempio n. 1
0
        public virtual void Decode(N2HBinaryReader reader)
        {
            var type = FarId == 0 ? AESEngine.AESType.SYMMETRIC : AESEngine.AESType.DEFAULT;

            RtmfpUtils.Decode(AesDecrypt.Next(type), reader);
            PrevAesType = type;
        }
Esempio n. 2
0
        public void Flush(byte marker, bool echoTime, AESEngine.AESType aesType)
        {
            _lastFlowWriter = null;
            if (IsEnqueueForDelete)
            {
                return;
            }
            var outputBuffer = Writer.BaseStream;

            if (outputBuffer.Length >= Defines.RTMFP_MIN_PACKET_SIZE)
            {
                //Debug.WriteLine(outputBuffer.Length);
                if (RecTimestamp.Elapsed > TimeSpan.FromSeconds(30))
                {
                    echoTime = false;
                }
                var offset = 0;
                if (echoTime)
                {
                    marker += 4;
                }
                else
                {
                    offset = 2;
                }
                var timeStamp = RtmfpUtils.TimeNow();
                //_outputBuffer.Ignore(offset);
                outputBuffer.Position = 6 + offset;
                outputBuffer.WriteByte(marker);
                Writer.Write(timeStamp);
                if (echoTime)
                {
                    Writer.Write((ushort)(TimeSent + RtmfpUtils.Time(RecTimestamp.Elapsed)));
                }
                RtmfpUtils.EncodeAndPack(AesEncrypt.Next(aesType), Writer, FarId, offset);
                EnqueueForOutbound(outputBuffer as MemoryStream, offset);
                Writer.Clear(11);
            }
        }