Ejemplo n.º 1
0
 /// <summary>Gets the CRL object using a CRL URL.</summary>
 /// <param name="url">the URL where the CRL is located</param>
 /// <returns>CRL object</returns>
 public static X509Crl GetCRL(String url)
 {
     if (url == null)
     {
         return(null);
     }
     return(SignUtils.ParseCrlFromStream(UrlUtil.OpenStream(new Uri(url))));
 }
Ejemplo n.º 2
0
        /// <summary>Gets a list of X509CRL objects from a Document Security Store.</summary>
        /// <returns>a list of CRLs</returns>
        /// <exception cref="Org.BouncyCastle.Security.GeneralSecurityException"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual IList <X509Crl> GetCRLsFromDSS()
        {
            IList <X509Crl> crls = new List <X509Crl>();

            if (dss == null)
            {
                return(crls);
            }
            PdfArray crlarray = dss.GetAsArray(PdfName.CRLs);

            if (crlarray == null)
            {
                return(crls);
            }
            for (int i = 0; i < crlarray.Size(); i++)
            {
                PdfStream stream = crlarray.GetAsStream(i);
                crls.Add((X509Crl)SignUtils.ParseCrlFromStream(new MemoryStream(stream.GetBytes())));
            }
            return(crls);
        }
Ejemplo n.º 3
0
 /// <summary>Fetches a CRL for a specific certificate online (without further checking).</summary>
 /// <param name="signCert">the certificate</param>
 /// <param name="issuerCert">its issuer</param>
 /// <returns>an X509CRL object</returns>
 public virtual X509Crl GetCRL(X509Certificate signCert, X509Certificate issuerCert)
 {
     if (issuerCert == null)
     {
         issuerCert = signCert;
     }
     try {
         // gets the URL from the certificate
         String crlurl = CertificateUtil.GetCRLURL(signCert);
         if (crlurl == null)
         {
             return(null);
         }
         LOGGER.Info("Getting CRL from " + crlurl);
         return((X509Crl)SignUtils.ParseCrlFromStream(UrlUtil.OpenStream(new Uri(crlurl))));
     }
     catch (System.IO.IOException) {
         return(null);
     }
     catch (GeneralSecurityException) {
         return(null);
     }
 }