String dn = CertTools.stringToBCDNString(issuerDN);
String dn = CertTools.stringToBCDNString(StringTools.strip(issuerDN));
	 public Collection findCertificatesByType(Admin admin, int type, String issuerDN) {		debug(">findCertificatesByType()");		if (null == admin 			|| type <= 0 			|| type > SecConst.CERTTYPE_SUBCA + SecConst.CERTTYPE_ENDENTITY + SecConst.CERTTYPE_ROOTCA) {			throw new IllegalArgumentException();        		}		StringBuffer ctypes = new StringBuffer();		if ((type & SecConst.CERTTYPE_SUBCA) > 0) {			ctypes.append(SecConst.CERTTYPE_SUBCA);		}		if ((type & SecConst.CERTTYPE_ENDENTITY) > 0) {			if (ctypes.length() > 0) {				ctypes.append(", ");			}			ctypes.append(SecConst.CERTTYPE_ENDENTITY);		}		if ((type & SecConst.CERTTYPE_ROOTCA) > 0) {			if (ctypes.length() > 0) {				ctypes.append(", ");			}            			ctypes.append(SecConst.CERTTYPE_ROOTCA);		}		Connection con = null;		PreparedStatement ps = null;		ResultSet result = null;		try {			ArrayList vect;			StringBuffer stmt = new StringBuffer("SELECT DISTINCT fingerprint FROM CertificateData WHERE status = 20 AND ");			stmt.append(" type IN (");			stmt.append(ctypes.toString());			stmt.append(')');			if (null != issuerDN && issuerDN.length() > 0) {				String dn = CertTools.stringToBCDNString(issuerDN);				if (log.isDebugEnabled()) {					debug("findCertificatesByType() : Looking for cert with (transformed)DN: " + dn);				}				stmt.append(" AND issuerDN = '");				stmt.append(dn);				stmt.append('\'');			}			if (log.isDebugEnabled()) {				debug("findCertificatesByType() : executing SQL statement\n"					  + stmt.toString());			}			con = getConnection();			ps = con.prepareStatement(stmt.toString());			result = ps.executeQuery();			vect = new ArrayList();			while (result.next()) {				vect.add(findCertificateByFingerprint(admin, result.getString(1)));			}			debug("<findCertificatesByType()");			return vect;		} catch (Exception e) {			throw new EJBException(e);		} finally {		   try {				if (result != null) {					result.close();				}				if (ps != null) {					ps.close();				}				if (con != null) {					con.close();				}			} catch (SQLException se) {				error("Unable to cleanup after : findCertificatesByType()", se);			}		}	 } // findCertificatesByType