String certFile = request.getParameter("certificate");
request.setAttribute("certificate", certFile);
InputStream is = new FileInputStream(certFile);
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());