public void encryptThenSend(byte[] plainText, Socket sock, boolean verbose) {
		if(verbose) {
			System.out.println();
			System.out.println("----------------------------------------------");
			System.out.print("Performing AES encryption on plain text: ");
			System.out.println(new String(plainText));
			System.out.print("The byte representation of the plaintext is: ");
			printBytes(plainText);
			System.out.println();
		}
		
		// Create the random initialisation vector.
		SecureRandom randomGenerator = new SecureRandom();
		byte[] iv = new byte[16]; 
		randomGenerator.nextBytes(iv);
		IvParameterSpec ivSpec = new IvParameterSpec(iv);
		if(verbose) {
			System.out.print("Generated AES IV: ");
			printBytes(iv);
			System.out.println();
		}
		
		// Perform the encryption.
		byte[] messageCipherText = null;
		try {
			theCipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, ivSpec);
			messageCipherText = theCipher.doFinal(plainText);
		} catch (Exception e) {
			e.printStackTrace();
		}
		if(verbose) {
			System.out.print("The encrypted bytes are: ");
			printBytes(messageCipherText);
			System.out.println();
		}
		
		// Insert the iv at the beginning of the message.
		byte[] cipherText = new byte[iv.length 
		                                 + messageCipherText.length];
		System.arraycopy(iv, 0, cipherText, 0, iv.length);
		System.arraycopy(messageCipherText, 0, cipherText, iv.length,
				messageCipherText.length);
		if(verbose) {
			System.out.print("The final message is: ");
			printBytes(cipherText);
			System.out.println();
			System.out.println("----------------------------------------------");
		}
		
		// Send the message.
		try {
			NetUtil.sendMessage(cipherText, sock);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}