def encrypt_file(self, file: str, key: int = 0) -> bool:

        # precondition
        assert isinstance(file, str) and isinstance(key, int)

        try:
            with open(file) as fin, open("encrypt.out", "w+") as fout:
                # actual encrypt-process
                for line in fin:
                    fout.write(self.encrypt_string(line, key))

        except OSError:
            return False

        return True