예제 #1
0
        static void registerDS(Oid oid, OidGroupEnum group, CultureInfo localeId, String cpsUrl)
        {
            String cn      = computeOidHash(oid.Value);
            String entryDN =
                DsUtils.AddEntry(
                    _baseDsPath,
                    $"CN={cn}",
                    DsUtils.SchemaObjectIdentifier);

            switch (group)
            {
            case OidGroupEnum.ApplicationPolicy:
                DsUtils.SetEntryProperty(entryDN, DsUtils.PropFlags, 3);
                break;

            case OidGroupEnum.IssuancePolicy:
                DsUtils.SetEntryProperty(entryDN, DsUtils.PropFlags, 2);
                if (!String.IsNullOrEmpty(cpsUrl))
                {
                    DsUtils.SetEntryProperty(entryDN, DsUtils.PropCpsOid, cpsUrl);
                }
                break;
            }
            DsUtils.SetEntryProperty(entryDN, DsUtils.PropCertTemplateOid, oid.Value);
            if (localeId == null)
            {
                DsUtils.SetEntryProperty(entryDN, DsUtils.PropDisplayName, oid.FriendlyName);
            }
            else
            {
                DsUtils.SetEntryProperty(entryDN, DsUtils.PropLocalizedOid, $"{localeId.LCID},{oid.FriendlyName}");
            }
        }
예제 #2
0
        /// <summary>
        /// Updates Enrollment Services URLs in the Active Directory.
        /// </summary>
        /// <exception cref="NotSupportedException">Enrollment Service URLs are not supported in workgroups.</exception>
        public void UpdateEnrollmentServiceUri()
        {
            if (String.IsNullOrEmpty(DistinguishedName))
            {
                throw new NotSupportedException("Enrollment Service URLs are not supported in workgroups.");
            }

            DsUtils.SetEntryProperty(DistinguishedName, DsUtils.PropPkiEnrollmentServers, EnrollmentEndpoints.DsEncode());
        }
예제 #3
0
        /// <summary>
        /// Updates Enrollment Services URLs in the Active Directory.
        /// </summary>
        public void UpdateEnrollmentServiceUri()
        {
            if (String.IsNullOrEmpty(DistinguishedName))
            {
                throw new NotSupportedException("Enrollment Service URLs are not supported for Standalone CAs.");
            }
            Object value = null;

            if (EnrollmentServiceURI != null && EnrollmentServiceURI.Length > 0)
            {
                List <String> uris = new List <String>();
                foreach (CESUri uri in EnrollmentServiceURI)
                {
                    uri.DisplayName = DisplayName;
                    uris.Add(uri.Priority + "\n" + (Int32)uri.Authentication + "\n" + Convert.ToInt32(uri.RenewalOnly) + "\n" +
                             uri.Uri.AbsoluteUri);
                }
                value = uris.ToArray();
            }
            DsUtils.SetEntryProperty(DistinguishedName, DsUtils.PropPkiEnrollmentServers, value);
        }