예제 #1
0
 /// <summary>
 /// Enumerates certificate templates registered in Active Directory.
 /// </summary>
 /// <returns>An array of certificate templates.</returns>
 public static CertificateTemplate[] EnumTemplates()
 {
     if (DsUtils.Ping())
     {
         String           cn      = _baseDsPath;
         DirectoryEntries entries = DsUtils.GetChildItems(cn);
         return((from DirectoryEntry item in entries select new CertificateTemplate("name", (String)item.Properties["cn"].Value)).ToArray());
     }
     throw new Exception(Error.E_DCUNAVAILABLE);
 }
예제 #2
0
        /// <summary>
        /// Enumerates certificate templates registered in Active Directory.
        /// </summary>
        /// <returns>An array of certificate templates.</returns>
        public static CertificateTemplate[] EnumTemplates()
        {
            if (!DsUtils.Ping())
            {
                throw new Exception(Error.E_DCUNAVAILABLE);
            }

            var retValue = new List <CertificateTemplate>();

            foreach (DirectoryEntry dsEntry in DsUtils.GetChildItems(_baseDsPath))
            {
                using (dsEntry) {
                    retValue.Add(FromCommonName(dsEntry.Properties["cn"].Value.ToString()));
                }
            }
            return(retValue.ToArray());
        }