public void sendFirst () {

        tradeElGamal(true);
        com.sendTo(1, "elgamal check.");

        final int n = 4; // rand.nextInt(10)+1;
        final BigInteger p_a = new BigInteger(52, 100, rand);
        {
             BigInteger tmp;
             do {
                 tmp = new BigInteger(p_a.bitLength()-8, rand);
             } while(tmp.compareTo(p_a) >= 0);
             M = tmp;
        }

        com.sendTo(1, Integer.toString(n, 16));
        com.sendTo(1, p_a.toString(16));
        com.sendTo(1, M.toString(16));

        final BigInteger p_b = new BigInteger(com.receive(), 16);

        // generate pohlig hellman puzzles
        final BigInteger[] keys_a = Vertrag.genRandomPHKeys(n*2, p_a);
        final BigInteger[] puzzles_a = Vertrag.genPHPuzzles(keys_a, M, p_a);
        final BigInteger[] puzzles_b = new BigInteger[n*2];

        // trade puzzles
        for(int i = 0; i < n*2; i+=2) {
            // send every second puzzle
            com.sendTo(1, puzzles_a[i+0].toString(16));
            com.sendTo(1, puzzles_a[i+1].toString(16));
            puzzles_b[i+0] = new BigInteger(com.receive(), 16);
            puzzles_b[i+1] = new BigInteger(com.receive(), 16);
        }

        {
            // generate the contract thingie
            String vertrag_a = genVertrag(keys_a, "vertrag.txt");
            BigInteger hash_a = genDigest(vertrag_a);
            BigInteger signature_a = elGamalS_own.signBlock(hash_a);

            com.sendTo(1, vertrag_a);
            com.sendTo(1, signature_a.toString(16));
        }

        String vertrag_b = com.receive();

        {
            BigInteger signature_b = new BigInteger(com.receive(), 16);

            if(!elGamalS_other.verifyBlock(genDigest(vertrag_b), signature_b)) {
                // NONONONONO
                com.sendTo(1, "1");
                System.err.println("That's not bob's signature!");
                System.exit(1);
            }

            // Commence operation.
            com.sendTo(1, "0");

            String commence = com.receive();
            if(!commence.equals("0")) {
                System.err.println("Bob aborted.");
                System.exit(1);
            }

        }

        com.sendTo(1, "secrets check");

        // Trade puzzles using the Geheimnisaustausch thingie.
        try {

            BigInteger[] keys_b = shareSecrets(true, keys_a, puzzles_b, p_b);

            System.out.println("Checking solutions: ");
            for(int i = 0; i < n*2; i++) {
                if(!solvesPuzzle(puzzles_b[i], keys_b[i], p_b))
                    throw new Exception("Could not solve puzzle B_{" + i/2 + "," + (i%2+1) + "}!");
                System.out.print(".");
            }
            System.out.println();
            System.out.println("Looking good!");

        } catch(Exception e) {
            e.printStackTrace();
            System.exit(1);
        }

    }