Ejemplo n.º 1
0
        public override void ToStream(Stream output)
        {
            output.Write(TLUtils.SignatureToBytes(Signature));

            Hash.ToStream(output);
            Salt.ToStream(output);
            IsSimple.ToStream(output);
            CloseTime.ToStream(output);
            AutolockTimeout.ToStream(output);
            Locked.ToStream(output);
        }
Ejemplo n.º 2
0
 public void TestSaltStream()
 {
     Salt s = new Salt();
     Assert.AreEqual(s.ToArray(), IOStream.ReadAllBytes(s.ToStream()));
 }
Ejemplo n.º 3
0
        public void TestSaltStream()
        {
            Salt s = new Salt();

            Assert.AreEqual(s.ToArray(), IOStream.ReadAllBytes(s.ToStream()));
        }
 private static Salt SessionSecret(Salt clientKeyBits, byte[] serverKeyBits)
 {
     Salt sessionSecret = Salt.FromBytes(
         Hash.SHA256(
             new CombinedStream(
                 clientKeyBits.ToStream(),
                 new MemoryStream(serverKeyBits, false)
                 )
             ).ToArray()
         );
     return sessionSecret;
 }
Ejemplo n.º 5
0
 /// <summary> Returns a stream that combines the salt and data </summary>
 public static Stream CombineStream(Salt salt, Stream data)
 {
     return new IO.CombinedStream(salt.ToStream(), data);
 }