Exemplo n.º 1
0
        void prover_main(string channel_name)
        {
            Channel channel          = Channel.connect(channel_name);
            Nonce   picoNonce        = new Nonce();
            KeyPair picoEphemeralKey = new KeyPair();

            picoEphemeralKey.generate();
            KeyPair picoIdentityKey = new KeyPair();

            picoIdentityKey.generate();
            picoNonce.generate_random();

            Nonce   serviceNonce    = new Nonce();
            IntPtr  serviceEphemKey = IntPtr.Zero;
            EncKeys keys            = new EncKeys();

            // Send start message
            send_start_message(channel, 2, picoEphemeralKey, picoNonce);

            // Receive service auth message
            receive_service_auth_message(channel, ref keys, picoEphemeralKey, picoNonce, ref serviceEphemKey, ref serviceNonce);

            // Send pico auth message
            send_pico_auth_message(channel, keys, serviceNonce, picoIdentityKey, picoEphemeralKey, "Test data");

            // Receive status message
            receive_status_message(channel, keys, "123456");

            picoEphemeralKey.delete();
            picoIdentityKey.delete();
            channel.delete();
            picoNonce.delete();
            serviceNonce.delete();
        }