コード例 #1
0
        public static Int32 Main(string[] args) {
            Console.CancelKeyPress += new ConsoleCancelEventHandler(MainClass.ConsoleShutdown);

            Server myServer = new Server();
            try {
                myServer.Start();
                do {
                    myServer.Update();
                    Thread.Sleep(10);
                    if (MainClass.doShutDown == true)
                        break;
                } while (true);

                myServer.Stop();
                return 0;
            } catch (Exception e) {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.BackgroundColor = ConsoleColor.Gray;
                Console.WriteLine(e);
                Console.ReadKey();
                return -1;
            }

            using (var ec = new ECDiffieHellmanCng(eccKey)) {
                var message = "Hello World!";
                Console.WriteLine("Real Message: ");
                Console.WriteLine(message);
            }
        }
コード例 #2
0
 public Client(Server parent,
               TcpClient client) {
     this.server = parent;
     this.client = client;
     this.cngECC = new ECDiffieHellmanCng(parent.GetKey());
     (new System.Random()).NextBytes(this.rsaSecretKey);
     this.cipher = CipherUtilities.GetCipher("AES/CTR/NoPadding");
 }