Esempio n. 1
0
        /// <summary>
        /// Returns the DtmForwardKeyStruct as an encoded MemoryStream
        /// </summary>
        ///
        /// <returns>The serialized DtmForwardKeyStruct</returns>
        public MemoryStream ToStream()
        {
            MemoryStream stream = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(stream);

            KeyParams.Serialize(Key).CopyTo(stream);
            writer.Write(SessionParams.ToBytes());
            writer.Write((long)LifeSpan);
            writer.Write((short)Instruction);
            writer.Write((long)OptionsFlag);

            stream.Seek(0, SeekOrigin.Begin);

            return(stream);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the DtmPacket as an encoded MemoryStream
        /// </summary>
        ///
        /// <returns>The serialized DtmPacket</returns>
        public MemoryStream ToStream()
        {
            MemoryStream stream = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(stream);

            byte[] data;

            writer.Write((int)Identity.Length);
            writer.Write(Identity);
            writer.Write((int)PkeId.Length);
            writer.Write(PkeId);
            data = Session.ToBytes();
            writer.Write((int)data.Length);
            writer.Write(data);
            writer.Write((long)OptionFlag);
            stream.Seek(0, SeekOrigin.Begin);

            return(stream);
        }