/** * Returns the hashcode of this CRL instance. * * @return the hashcode. */ public int hashCode() { try { int res = 0; byte[] array = getEncoded(); for (int i=0; i<array.length; i++) { res += array[i] & 0xFF; } return res; } catch (CRLException e) { return 0; } }
/** * Returns whether the specified object equals to this instance. * * @param other * the object to compare. * @return {@code true} if the specified object is equal to this, otherwise * {@code false}. */ public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof X509CRL)) { return false; } X509CRL obj = (X509CRL) other; try { return Arrays.equals(getEncoded(), obj.getEncoded()); } catch (CRLException e) { return false; } }
/** * Returns the issuer distinguished name of this CRL. * * @return the issuer distinguished name of this CRL. */ public X500Principal getIssuerX500Principal() { try { // TODO if there is no X.509 certificate provider installed // should we try to access Harmony X509CRLImpl via classForName? CertificateFactory factory = CertificateFactory .getInstance("X.509"); X509CRL crl = (X509CRL) factory .generateCRL(new ByteArrayInputStream(getEncoded())); return crl.getIssuerX500Principal(); } catch (Exception e) { throw new RuntimeException("Failed to get X500Principal issuer", e); } }
/** * Adds a CRL to this revocation data set. * * @param crl */ public void addCRL(X509CRL crl) { byte[] encodedCrl; try { encodedCrl = crl.getEncoded(); } catch (CRLException e) { throw new IllegalArgumentException("CRL coding error: " + e.getMessage(), e); } addCRL(encodedCrl); }
} else { X509CRL res = new X509CRLImpl(inStream); CRL_CACHE.put(hash, res.getEncoded(), res); return res;
/** * Writes a CRL in base64 format. * Does NOT close the stream. Throws on all errors. * * @throws CRLException if the crl does not support encoding * @since 0.9.25 */ public static void exportCRL(X509CRL crl, OutputStream out) throws IOException, CRLException { byte[] buf = crl.getEncoded(); writePEM(buf, "X509 CRL", out); }
public DigestAlgAndValue(XAdESStructure parent, X509CRL crl, String xadesPrefix, String xadesNamespace, String xmlSignaturePrefix) throws GeneralSecurityException { this(parent, "DigestAlgAndValue", crl.getEncoded(), xadesPrefix, xadesNamespace, xmlSignaturePrefix); }
COSStream crlStream = writeDataToStream(crl.getEncoded()); crls.add(crlStream); if (correspondingCRLs != null)
@Override public byte[] getEncoded() throws CRLException { X509CRL crl = this.crl; if (crl != null) { return crl.getEncoded(); } else { return new byte[0]; } }
/** * Base constructor. * * @param crl CRL to be used a the source for the holder creation. * @throws CRLException if there is a problem extracting the CRL information. */ public JcaX509CRLHolder(X509CRL crl) throws CRLException { super(CertificateList.getInstance(crl.getEncoded())); } }
/** * Base constructor. * * @param crl CRL to be used a the source for the holder creation. * @throws CRLException if there is a problem extracting the CRL information. */ public JcaX509CRLHolder(X509CRL crl) throws CRLException { super(CertificateList.getInstance(crl.getEncoded())); } }
public static byte[] getEncoded(X509CRL x509CRL) { try { final byte[] encoded = x509CRL.getEncoded(); return encoded; } catch (CRLException e) { throw new DSSException(e); } }
/** * Creates an instance of a CrlClient in case you * have a local cache of the Certificate Revocation List. * @param crl a CRL object */ public CrlClientOffline(CRL crl) { try { crls.add(((X509CRL)crl).getEncoded()); } catch (Exception ex) { throw new ExceptionConverter(ex); } }
/** * Creates an instance of a CrlClient in case you * have a local cache of the Certificate Revocation List. * @param crl a CRL object */ public CrlClientOffline(CRL crl) { try { crls.add(((X509CRL)crl).getEncoded()); } catch (Exception ex) { throw new ExceptionConverter(ex); } }
/** * Creates an instance of a CrlClient in case you * have a local cache of the Certificate Revocation List. * * @param crl a CRL object */ public CrlClientOffline(CRL crl) { try { crls.add(((X509CRL) crl).getEncoded()); } catch (Exception ex) { throw new PdfException(ex); } }
/** * Creates an instance of a CrlClient in case you * have a local cache of the Certificate Revocation List. * * @param crl a CRL object */ public CrlClientOffline(CRL crl) { try { crls.add(((X509CRL) crl).getEncoded()); } catch (Exception ex) { throw new PdfException(ex); } }
@Override @SneakyThrows protected boolean addCRL(final Object id, final X509CRL crl) { if (crl == null) { LOGGER.debug("No CRL was passed. Removing [{}] from cache...", id); return this.crlCache.remove(id); } this.crlCache.put(new Element(id, crl.getEncoded())); return this.crlCache.get(id) != null; } }
@Override public byte[] getEncoded() { try { return crlValidity.x509CRL.getEncoded(); } catch (CRLException e) { throw new DSSException("CRL encoding error: " + e.getMessage(), e); } }
private DEREncodableVector getCRLsVector() throws IOException { final DEREncodableVector v = new ASN1EncodableVector(); for (CRL crl : crls) { final X509CRL x509crl = (X509CRL) crl; try { v.add(ASN1Object.fromByteArray(x509crl.getEncoded())); } catch (CRLException e) { // This is thrown if an encoding error occurs. throw new IOException(e); } } return v; }
private static void marshalCRL(XmlWriter xwriter, X509CRL crl, String dsPrefix) throws MarshalException { try { byte[] encoded = crl.getEncoded(); xwriter.writeTextElement(dsPrefix, "X509CRL", XMLSignature.XMLNS, XMLUtils.encodeToString(encoded)); } catch (CRLException e) { throw new MarshalException("Error encoding X509CRL", e); } }