def METHOD_NAME(self):
    data = {}
    for key in ("cn", "c", "st", "l", "o", "ou", "email", "alt_names", "bits", "validity", "ca"):
        val = self.oget("DEFAULT", key)
        if val is not None:
            data[key] = val
    ca = data.get("ca")
    casec = None
    if ca is not None:
        casecname, canamespace, _ = split_path(ca)
        casec = factory("sec")(casecname, namespace=canamespace, log=self.log, volatile=True)
        if not casec.exists():
            raise ex.Error("ca secret %s does not exist" % ca)
    for key in ("crt", "key", "csr"):
        data[key] = self.tempfilename()
    if "alt_names" in data:
        data["cnf"] = self.tempfilename()
    try:
        add_data = []
        if casec:
            for key, kw in (("cacrt", "certificate"), ("cakey", "private_key")):
                if kw not in casec.data_keys():
                    continue
                data[key] = self.tempfilename()
                buff = bdecode(casec.decode_key(kw))
                with open(data[key], "w") as ofile:
                    ofile.write(buff)
        METHOD_NAME(log=self.log, **data)
        with open(data["key"], "r") as ofile:
            buff = ofile.read()
        fullpem = ""
        fullpem += buff
        add_data.append(("private_key", buff))
        if data.get("crt") is not None:
            with open(data["crt"], "r") as ofile:
                buff = ofile.read()
            add_data.append(("certificate", buff))
        if data.get("csr") is not None:
            with open(data["csr"], "r") as ofile:
                buff = ofile.read()
            add_data.append(("certificate_signing_request", buff))
        if data.get("cakey") is None:
            with open(data["crt"], "r") as ofile:
                buff = ofile.read()
            fullpem += buff
            add_data.append(("certificate_chain", buff))
        else:
            # merge cacrt and crt
            with open(data["crt"], "r") as ofile:
                buff = ofile.read()
            with open(data["cacrt"], "r") as ofile:
                buff += ofile.read()
            fullpem += buff
            add_data.append(("certificate_chain", buff))
        add_data.append(("fullpem", fullpem))
        self._add_keys(add_data)
    finally:
        for key in ("crt", "key", "cacrt", "cakey", "csr", "cnf"):
            if key not in data:
                continue
            try:
                os.unlink(data[key])
            except Exception:
                pass