List of usage examples for java.security.cert CertificateFactory generateCRLs
public final Collection<? extends CRL> generateCRLs(InputStream inStream) throws CRLException
From source file:mitm.common.security.crl.CRLUtils.java
/** * Reads and returns all encoded CRLs from the input stream. *//* w w w .ja v a2 s . c om*/ public static Collection<? extends CRL> readCRLs(InputStream input) throws CertificateException, NoSuchProviderException, SecurityFactoryFactoryException, CRLException { if (!(input instanceof BufferedInputStream)) { input = new BufferedInputStream(input); } CertificateFactory fac = SecurityFactoryFactory.getSecurityFactory().createCertificateFactory("X.509"); return fac.generateCRLs(input); }
From source file:org.opensaml.xml.security.x509.X509Util.java
/** * Decodes CRLS in DER or PKCS#7 format. If in PKCS#7 format only the CRLs are decode, the rest of the content is * ignored./*from w ww .j a va 2s . c om*/ * * @param crls encoded CRLs * * @return decoded CRLs * * @throws CRLException thrown if the CRLs can not be decoded */ @SuppressWarnings("unchecked") public static Collection<X509CRL> decodeCRLs(byte[] crls) throws CRLException { try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); return (Collection<X509CRL>) cf.generateCRLs(new ByteArrayInputStream(crls)); } catch (GeneralSecurityException e) { throw new CRLException("Unable to decode X.509 certificates"); } }
From source file:org.qipki.ca.http.presentation.rest.resources.tools.CryptoInspectorResource.java
private boolean isDER(InputStream stream) { CertificateFactory certFactory = null; try {/*from w w w .ja v a2s . com*/ certFactory = CertificateFactory.getInstance("X.509", BouncyCastleProvider.PROVIDER_NAME); } catch (GeneralSecurityException ignored) { return false; } try { certFactory.generateCRLs(stream); return true; } catch (CRLException ignored) { } try { certFactory.generateCertificates(stream); return true; } catch (CertificateException ignored) { } // TODO : all other types ........ return false; }