String certificate = request.getParameter("certificate");
request.setAttribute("certificate", certificate);
InputStream is = new ByteArrayInputStream(certificate.getBytes());
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Collection certificates = cf.generateCertificates(is);
X509Certificate cert = (X509Certificate) certificates.iterator().next();
request.setAttribute("fingerprint", CertificateUtil.generateFingerprint(cert, "MD5"));
request.setAttribute("issuer", cert.getIssuerDN().getName());
request.setAttribute("subject", cert.getSubjectDN().getName());
request.setAttribute("serial", cert.getSerialNumber());