Ejemplo n.º 1
0
        static String getEntryName(X509CRL2 crl)
        {
            X509PublishedCrlLocationsExtension pubCrl = (X509PublishedCrlLocationsExtension)crl.Extensions[X509CertExtensions.X509PublishedCrlLocations];

            return(pubCrl == null
                ? getEntryNameFromIssuer(crl)
                : getEntryNameFromUrl(pubCrl));
        }
Ejemplo n.º 2
0
 static String getEntryNameFromUrl(X509PublishedCrlLocationsExtension pubCrl)
 {
     String[] urls = pubCrl.GetUrLs().Where(x => x.ToUpper().Contains("LDAP://")).ToArray();
     if (urls.Length == 0)
     {
         throw new ArgumentException("Cannot find target location.");
     }
     String[] tokens = urls[0].Split(new[] { "CN=" }, StringSplitOptions.RemoveEmptyEntries);
     return(HttpUtility.UrlDecode(tokens[1].TrimEnd(',')));
 }
Ejemplo n.º 3
0
 static String getHostName(String suggestedHostName, X509CRL2 crl)
 {
     if (String.IsNullOrWhiteSpace(suggestedHostName))
     {
         X509PublishedCrlLocationsExtension pubCrl = (X509PublishedCrlLocationsExtension)crl.Extensions[X509CertExtensions.X509PublishedCrlLocations];
         if (pubCrl == null)
         {
             throw new ArgumentException("Cannot find target location.");
         }
         String[] urls = pubCrl.GetUrLs().Where(x => x.ToUpper().Contains("LDAP://")).ToArray();
         if (urls.Length == 0)
         {
             throw new ArgumentException("Cannot find target location.");
         }
         var tokens = urls[0].ToUpper().Split(new[] { "CN=" }, StringSplitOptions.RemoveEmptyEntries);
         suggestedHostName = tokens[2];
     }
     return(suggestedHostName);
 }