/** * Constructs a X509CRL instance from a PEM encoded CRL */ public static X509CRL getCRLFromPEM(final String pemContent) throws GeneralSecurityException { Args.notNull("pemContent", pemContent); final Matcher m = CRL_PATTERN.matcher(pemContent); final byte[] certBytes; if (m.find()) { certBytes = pemContent.getBytes(); } else { certBytes = ("-----BEGIN X509 CRL-----\n" + pemContent + "\n-----END X509 CRL-----").getBytes(); } final CRL cert = CERTIFICATE_FACTORY.generateCRL(new ByteArrayInputStream(certBytes)); if ("X.509".equals(cert.getType())) return (X509CRL) cert; throw new GeneralSecurityException("PEM-encoded CRL [" + pemContent + "] is not X.509 but [" + cert.getType() + "]"); }