private static void encrypt(String[] args) throws Exception {
        // Read key file
        String filename = "";
        String keyString = "";
        for (String s : args) {
            if (s.equals("public.key")) {
                filename = s;
            }
        }

        // read in the public key
        BufferedReader bf = null;
        try {
            bf = new BufferedReader(new FileReader(filename));
            keyString = bf.readLine();
        } catch (IOException e) {
            System.exit(2);
        } finally {
            if (bf != null) {
                bf.close();
            }
        }

        // Init crypto object with key
        final String[] key = keyString.split(",");

        validatePublicKeyInput(key);

        final Crypto crypto = new Crypto(key);
        int blocksize = 2;
        int bytesRead = 0;
        byte[] block = new byte[blocksize];

        try {
            U.p(block);
            do {
                bytesRead = System.in.read(block, 0, block.length);
                if (bytesRead == 2) {
                    System.out.println(crypto.encryptBlock(block));
                } else if (bytesRead > 0) { // Pad input block if not large enough for block
                    for (int i = bytesRead; i < blocksize; ++i) {
                        block[i] = 0;
                    }
                    System.out.println(crypto.encryptBlock(block));
                }
            } while (bytesRead > 0);
        } catch (IOException e) {
            U.p(e.getMessage());
        }
    }