log.debug("Created certificate of class: " + x509cert.getClass().getName());
    private static String getDN(X509Certificate cert, int which) {        //log.debug(">getDN("+which+")");        String dn = null;        if (cert == null) {            return dn;        }        try {            CertificateFactory cf = CertTools.getCertificateFactory();            X509Certificate x509cert = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(                        cert.getEncoded()));            log.debug("Created certificate of class: " + x509cert.getClass().getName());            if (which == 1) {                dn = x509cert.getSubjectDN().toString();            } else {                dn = x509cert.getIssuerDN().toString();            }        } catch (CertificateException ce) {            log.error("CertificateException: ", ce);            return null;        }        //log.debug("<getDN("+which+"):"+dn);        return stringToBCDNString(dn);    } // getDN