Refine search
/** * @see java.security.cert.CertificateFactorySpi#engineGenerateCRL(InputStream) * method documentation for more info */ public CRL engineGenerateCRL(InputStream inStream) throws CRLException { if (inStream == null) { throw new CRLException("inStream == null"); } try { if (!inStream.markSupported()) { // Create the mark supporting wrapper // Mark is needed to recognize the format // of provided encoding form (ASN.1 or PEM) inStream = new RestoringInputStream(inStream); } inStream.mark(1); // check whether the provided crl is in PEM encoded form if (inStream.read() == '-') { // decode PEM, retrieve CRL return getCRL(decodePEM(inStream, FREE_BOUND_SUFFIX)); } else { inStream.reset(); // retrieve CRL return getCRL(inStream); } } catch (IOException e) { throw new CRLException(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); }
throw new CRLException("InputStream doesn't contain enough data"); byte[] encoding = new byte[BerInputStream.getLength(buff)]; if (encoding.length < CRL_CACHE_SEED_LENGTH) { throw new CRLException("Bad CRL encoding"); } else { X509CRL res = new X509CRLImpl(inStream); CRL_CACHE.put(hash, res.getEncoded(), res); return res;
/** * return the issuer of the given CRL as an X509PrincipalObject. */ public static X509Principal getIssuerX509Principal( X509CRL crl) throws CRLException { try { ByteArrayInputStream bIn = new ByteArrayInputStream( crl.getTBSCertList()); ASN1InputStream aIn = new ASN1InputStream(bIn); TBSCertList tbsCertList = new TBSCertList( (ASN1Sequence)aIn.readObject()); return new X509Principal(tbsCertList.getIssuer()); } catch (IOException e) { throw new CRLException(e.toString()); } } }
static boolean isIndirectCRL(X509CRL crl) throws CRLException { try { byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId()); return idp != null && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL(); } catch (Exception e) { throw new CRLException( "Exception reading IssuingDistributionPoint: " + e); } } }
/** * Add the CRLEntry objects contained in a previous CRL. * * @param other the X509CRL to source the other entries from. */ public void addCRL(X509CRL other) throws CRLException { Set revocations = other.getRevokedCertificates(); if (revocations != null) { Iterator it = revocations.iterator(); while (it.hasNext()) { X509CRLEntry entry = (X509CRLEntry)it.next(); ASN1InputStream aIn = new ASN1InputStream(entry.getEncoded()); try { tbsGen.addCRLEntry(ASN1Sequence.getInstance(aIn.readObject())); } catch (IOException e) { throw new CRLException("exception processing encoding of CRL: " + e.toString()); } } } }
public byte[] getEncoded() throws CRLException { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DEROutputStream dOut = new DEROutputStream(bOut); try { dOut.writeObject(c); return bOut.toByteArray(); } catch (IOException e) { throw (CRLException)new CRLException(e.getMessage()).initCause(e); } }
@Override public void verify(PublicKey key, String sigProvider) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { X509CRL crl = this.crl; if (crl != null) { crl.verify(key, sigProvider); } else { throw new CRLException("No CRL loaded, nothing to verify."); } }
} catch (CRLException e) { throw new RuntimeException("CRL parse error: " + e.getMessage(), e); String issuerName = crl.getIssuerDN().getName().replace(",", ", "); crlIdentifier.setIssuer(issuerName); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Z"), Locale.ROOT); cal.setTime(crl.getThisUpdate()); crlIdentifier.setIssueTime(cal); crlIdentifier.setNumber(getCrlNumber(crl));
public final java.security.cert.CRLException crlNotSupported(final java.lang.String algorithm) { java.security.cert.CRLException result = new java.security.cert.CRLException(java.lang.String.format(crlNotSupported$str(), algorithm)); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
if (crl.getCRL().getNextUpdate().before(new Date())) { } catch (CRLException e) { addFileIndex(uRLCRL); logger.info("File [" + fileCRL + "] is corrupted, probably due to " + e.getMessage() + ".Removing the corrupted file."); if (!fileCRL.delete()) { logger.info("There was a failed attempt to file removal.");
private void checkSignatureValue(final X509CRL x509CRL, final CertificateToken issuerToken, final CRLValidity crlValidity) { try { x509CRL.verify(issuerToken.getPublicKey()); crlValidity.signatureIntact = true; crlValidity.issuerToken = issuerToken; } catch (InvalidKeyException e) { crlValidity.signatureInvalidityReason = e.getClass().getSimpleName() + " - " + e.getMessage(); } catch (CRLException e) { crlValidity.signatureInvalidityReason = e.getClass().getSimpleName() + " - " + e.getMessage(); } catch (NoSuchAlgorithmException e) { crlValidity.signatureInvalidityReason = e.getClass().getSimpleName() + " - " + e.getMessage(); } catch (SignatureException e) { crlValidity.signatureInvalidityReason = e.getClass().getSimpleName() + " - " + e.getMessage(); } catch (NoSuchProviderException e) { throw new DSSException(e); } }
@Override public X509CRL findCrl(URI crlUri, X509Certificate issuerCertificate, Date validationDate) { try { return getCrl(crlUri); } catch (CRLException e) { LOG.debug("error parsing CRL: " + e.getMessage(), e); return null; } catch (Exception e) { LOG.error("find CRL error: " + e.getMessage(), e); return null; } }
private static Collection convertCRLs(Collection collection) throws CRLException { List list = new ArrayList(collection.size()); for (Iterator it = collection.iterator(); it.hasNext();) { Object crl = it.next(); if (crl instanceof X509CRL) { try { list.add(new X509CRLHolder(((X509CRL)crl).getEncoded())); } catch (IOException e) { throw new CRLException("cannot read encoding: " + e.getMessage()); } } else { list.add((X509CRLHolder)crl); } } return list; } }
/** * return the issuer of the given CRL as an X509PrincipalObject. */ public static X509Principal getIssuerX509Principal( X509CRL crl) throws CRLException { try { TBSCertList tbsCertList = TBSCertList.getInstance( ASN1Primitive.fromByteArray(crl.getTBSCertList())); return new X509Principal(X509Name.getInstance(tbsCertList.getIssuer())); } catch (IOException e) { throw new CRLException(e.toString()); } } }
static boolean isIndirectCRL(X509CRL crl) throws CRLException { try { byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId()); return idp != null && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL(); } catch (Exception e) { throw new CRLException( "Exception reading IssuingDistributionPoint: " + e); } } }
/** * Add the CRLEntry objects contained in a previous CRL. * * @param other the X509CRL to source the other entries from. */ public void addCRL(X509CRL other) throws CRLException { Set revocations = other.getRevokedCertificates(); if (revocations != null) { Iterator it = revocations.iterator(); while (it.hasNext()) { X509CRLEntry entry = (X509CRLEntry)it.next(); ASN1InputStream aIn = new ASN1InputStream(entry.getEncoded()); try { tbsGen.addCRLEntry(ASN1Sequence.getInstance(aIn.readObject())); } catch (IOException e) { throw new CRLException("exception processing encoding of CRL: " + e.toString()); } } } }
public byte[] getEncoded() throws CRLException { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DEROutputStream dOut = new DEROutputStream(bOut); try { dOut.writeObject(c); return bOut.toByteArray(); } catch (IOException e) { throw (CRLException)new CRLException(e.getMessage()).initCause(e); } }
@Override public void verify(PublicKey key) throws CRLException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { X509CRL crl = this.crl; if (crl != null) { crl.verify(key); } else { throw new CRLException("No CRL loaded, nothing to verify."); } }
@Override public final CRLException crlNotSupported(final String algorithm) { final CRLException result = new CRLException(String.format(getLoggingLocale(), crlNotSupported$str(), algorithm)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } }