response.setContentLength(data.length);
response.getOutputStream().write(data);
} else if(csrId != null){
// Request is to download user's own certificate
// Get the serial number of the certificate based on the csrId
CertificateRequestStore certReqStore = CAHelperUtils.getCertificateRequestStore();
BigInteger sNo = certReqStore.getSerialNumberForRequest(csrId);
if(sNo == null) {
// Either the CSR is yet to be fulfilled or the csrId is invalid.
throw new Exception("Either the CSR is yet to be fulfilled or the csrId is invalid. csrId = "+csrId);
}
CertificateStore certStore = CAHelperUtils.getCertificateStore();