use of org.apache.commons.io.input.BoundedInputStream in project oxAuth by GluuFederation.
the class CRLCertificateVerifier method requestCRL.
public X509CRL requestCRL(String url) throws IOException, MalformedURLException, CertificateException, CRLException {
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
try {
con.setUseCaches(false);
InputStream in = new BoundedInputStream(con.getInputStream(), maxCrlSize);
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
X509CRL crl = (X509CRL) certificateFactory.generateCRL(in);
log.debug("CRL size: " + crl.getEncoded().length + " bytes");
return crl;
} finally {
IOUtils.closeQuietly(in);
}
} catch (IOException ex) {
log.error("Failed to download CRL from '" + url + "'", ex);
} finally {
if (con != null) {
con.disconnect();
}
}
return null;
}
Aggregations