public static Deserializer Deserialise(IBufferWriter <byte> plaintextBuffer, CryptoDtoChannelStore channelStore, ReadOnlyMemory <byte> bytes)
        {
            var header  = Deserializer.GetHeader(bytes, out ushort headerLength);
            var channel = channelStore.GetChannel(header.ChannelTag);

            return(new Deserializer(channel, headerLength, header, bytes.Span, false, plaintextBuffer));
        }
        public static Deserializer DeserializeIgnoreSequence(IBufferWriter <byte> plaintextBuffer, CryptoDtoChannelStore channelStore, ReadOnlyMemory <byte> bytes)  //This is used for UDP channels where duplication is possible and the overhead of CryptographicException isn't acceptable. Use IsSequenceValid() in code to ignore the UDP packet.
        {
            var header  = Deserializer.GetHeader(bytes, out ushort headerLength);
            var channel = channelStore.GetChannel(header.ChannelTag);

            return(new Deserializer(channel, headerLength, header, bytes.Span, true, plaintextBuffer));
        }
        public static Deserializer DeserializeIgnoreSequence(CryptoDtoChannelStore channelStore, ReadOnlyMemory <byte> bytes)  //This is used for UDP channels where duplication is possible and the overhead of CryptographicException isn't acceptable. Use IsSequenceValid() in code to ignore the UDP packet.
        {
            var plaintextBuffer = new ArrayBufferWriter <byte>();

            return(DeserializeIgnoreSequence(plaintextBuffer, channelStore, bytes));
        }
        public static Deserializer Deserialize(CryptoDtoChannelStore channelStore, ReadOnlyMemory <byte> bytes)
        {
            var plaintextBuffer = new ArrayBufferWriter <byte>();

            return(Deserialise(plaintextBuffer, channelStore, bytes));
        }
Exemple #5
0
        // Hint for callers using ArrayBufferWriter<byte> - output.WrittenSpan contains the serialised data
        public void Serialize <T>(IBufferWriter <byte> output, CryptoDtoChannelStore channelStore, string channelTag, CryptoDtoMode mode, T obj)
        {
            var channel = channelStore.GetChannel(channelTag);

            Serialize(output, channel, mode, obj);
        }
Exemple #6
0
        public byte[] Serialize <T>(CryptoDtoChannelStore channelStore, string channelTag, CryptoDtoMode mode, T obj)
        {
            var channel = channelStore.GetChannel(channelTag);

            return(Serialize(channel, mode, obj));
        }