certificateResponse = new String(Base64.encode(responseData.getResponseData(), false));
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
String pkcs7 = PEM_PKCS7_BEGIN + "\n" + new String(Base64.encode(responseData.getResponseData(), true)) + "\n" + PEM_PKCS7_END + "\n";
log.debug("pkcs7="+pkcs7);
CertPath certPath = cf.generateCertPath(new ByteArrayInputStream(responseData.getResponseData()), "PKCS7");
List<? extends Certificate> certList = certPath.getCertificates();
Certificate caCert = certList.get(certList.size()-1);
String caCertificate = new String(Base64.encode(caCert.getEncoded(), false));
resource = new ByteArrayResource(caCertificate.getBytes());
mimeType = "application/x-x509-ca-cert";