public static X509Certificate generateSignedCertificate(String dn, KeyPair keyPair,
                                                            int daysBeforeNow, int daysAfterNow, String issuer, KeyPair parentKeyPair,
                                                            String algorithm, boolean isCA, boolean isServerCert, boolean isClientCert,
                                                            String[] hostNames) throws CertificateException, IOException {
        return new CertificateBuilder(0, algorithm).sanDnsNames(hostNames).generateSignedCertificate(dn, keyPair,
                daysBeforeNow, daysAfterNow, issuer, parentKeyPair, isCA, isServerCert, isClientCert);
    }
Generate a signed certificate. Self-signed, if no issuer and parentKeyPair are supplied

@param dn The distinguished name of this certificate
@param keyPair A key pair
@param daysBeforeNow how many days before now the Certificate is valid for
@param daysAfterNow how many days from now the Certificate is valid for
@param issuer The issuer who signs the certificate. Leave null if you want to generate a root
       CA.
@param parentKeyPair The key pair of the issuer. Leave null if you want to generate a root
       CA.
@param algorithm the signing algorithm, eg "SHA1withRSA"
@return the signed certificate
@throws CertificateException
clients/src/test/java/org/apache/kafka/test/TestSslUtils.java