Esempio n. 1
0
 public new Socket Accept()
 {
     Socket client = base.Accept();
     SendString(client, parameters.Name);
     SendPoint(client, parameters.G * key);
     secret = ReceivePoint(client) * key;
     byte[] tmp = secret.X.ToBigInteger().ToByteArray();
     Array.Resize<byte>(ref tmp, 16);
     cipher = new Rijndael(tmp);
     initializationVector = secret.Y.ToBigInteger().ToByteArray();
     Console.WriteLine(secret);
     return client;
 }
Esempio n. 2
0
        public new void Connect(EndPoint remoteEP)
        {
            base.Connect(remoteEP);
            parameters = X9ECParameters.GetByName(ReceiveString(this));

            if (parameters == null)
            {
                base.Disconnect(false);
                return;
            }

            SendPoint(this, parameters.G * key);
            secret = ReceivePoint(this) * key;
            byte[] tmp = secret.X.ToBigInteger().ToByteArray();
            Array.Resize<byte>(ref tmp, 16);
            cipher = new Rijndael(tmp);
            initializationVector = secret.Y.ToBigInteger().ToByteArray();
            Console.WriteLine(secret);
        }