code: function normalizeX509(raw, loggerPrefix) {
      logger.debug(`${loggerPrefix} [normalizeX509] raw cert: ${raw}`);
      const regex = /(\-\-\-\-\-\s*BEGIN ?[^-]+?\-\-\-\-\-)([\s\S]*)(\-\-\-\-\-\s*END ?[^-]+?\-\-\-\-\-)/;
      let matches = raw.match(regex);
      if (!matches || matches.length !== 4) {
          throw new Error('Failed to find start line or end line of the certificate.');
      }
  
      // remove the first element that is the whole match
      matches.shift();
      // remove LF or CR
      matches = matches.map((element) => {
          return element.trim();
      });
  
      // make sure '-----BEGIN CERTIFICATE-----' and '-----END CERTIFICATE-----' are in their own lines
      // and that it ends in a new line
      return matches.join('\n') + '\n';
  }
docs: /*
  Make sure there's a start line with '-----BEGIN CERTIFICATE-----'
  and end line with '-----END CERTIFICATE-----', so as to be compliant
  with x509 parsers