def _update_broker_cert_chain(self, svc, ca_bundle_file):
        """
        Retrieve the latest ca bundle from the management service and update
        it on disk at the location supplied as the `ca_bundle_file` argument.

        :param dxlclient._cli._management_service.ManagementService svc: the
            management service to query for the new broker cert chain
        :param str ca_bundle_file: file at which to store the latest ca bundle
        """
        cert_chain = svc.invoke_command(self._BROKER_CERT_CHAIN_COMMAND)
        validate_cert_pem(cert_chain, "Failed to process PEM for CA bundle")
        logger.info("Updating certs in %s", ca_bundle_file)
        DxlUtils.save_to_file(ca_bundle_file, cert_chain)
    def _save_pem(pem, description, target_file):
        """
        Save the content of the string in the `pem` argument to the file name
        stored in the `target_file` argument.

        :param pem: content of the pem
        :param description: description of the content of the `pem`, used in
            the content of a message for an validation `Exception`, if raised.
        :param target_file: file at which to save the pem
        :raise Exception: if the contents of `pem` does not appear to be a PEM
            wrapping a valid ASN.1-encoded certificate
        """
        validate_cert_pem(pem,
                          "Failed to process PEM for {}".format(description))
        logger.info("Saving %s file to %s", description, target_file)
        DxlUtils.save_to_file(target_file, pem)