Пример #1
0
        void addCrlEntryFromDS(String containerName, String entryName, X509CRL2 crl)
        {
            var crlEntry = new DsCrlEntry(containerName, entryName, crl);

            _list.Add(crlEntry);
            _dsList[containerName].Add(crlEntry);
        }
Пример #2
0
 /// <summary>
 /// Removes CRL entry from Active Directory.
 /// </summary>
 /// <param name="entry">CRL entry to remove.</param>
 /// <exception cref="ArgumentNullException">
 /// <strong>entry</strong> parameter is null.
 /// </exception>
 /// <returns>
 /// <strong>True</strong> if specified CRL entry was found, otherwise <strong>False</strong>.
 /// </returns>
 public Boolean RemoveCrl(DsCrlEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException(nameof(entry));
     }
     if (!_list.Remove(entry))
     {
         return(false);
     }
     // mutually exclusive. entry cannot be added and removed at the same time.
     _toBeRemoved.Add(entry);
     _toBeAdded.Remove(entry);
     _dsList[entry.HostName].Remove(entry);
     return(IsModified = true);
 }
Пример #3
0
        /// <summary>
        /// Adds new certificate revocation list to Active Directory.
        /// </summary>
        /// <param name="crl">Specifies a CRL to publish in Active Directory.</param>
        /// <param name="hostName">
        /// Specifies host name of CA server that issued the CRL. This parameter is optional and can be omitted if
        /// CRL includes <strong>Published CRL Locations</strong> CRL extension. If specified, this parameter takes
        /// precedence over <strong>Published CRL Locations</strong> extension value.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <strong>crl</strong> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// There is no enough information to determine exact CRL publication location in Active Directory.
        /// </exception>
        /// <returns>
        /// This method always returns <strong>True</strong>.
        /// </returns>
        public Boolean AddCrl(X509CRL2 crl, String hostName = null)
        {
            if (crl == null)
            {
                throw new ArgumentNullException(nameof(crl));
            }
            String issuerName = getEntryName(crl);

            hostName = getHostName(hostName, crl);
            var entry = new DsCrlEntry(hostName, issuerName, crl);

            // we do not store multiple CRLs for single entry, instead, we overwrite them.
            // therefore we remove old entry and add new one (replace).
            _list.Remove(entry);
            _list.Add(entry);
            _toBeAdded.Add(entry);
            if (!_dsList.ContainsKey(hostName))
            {
                _dsList.Add(hostName, new List <DsCrlEntry>());
            }
            _dsList[hostName].Remove(entry);
            _dsList[hostName].Add(entry);
            return(IsModified = true);
        }
Пример #4
0
 /// <summary>
 /// Determines whether the specified object is equal to the current object. Two CRL entries are equal when
 /// all public members of this object are same.
 /// </summary>
 /// <inheritdoc cref="Equals(Object)" select="param|returns"/>
 /// <returns></returns>
 protected Boolean Equals(DsCrlEntry other)
 {
     return(String.Equals(HostName, other.HostName, StringComparison.OrdinalIgnoreCase) &&
            String.Equals(IssuerName, other.IssuerName, StringComparison.OrdinalIgnoreCase) &&
            CRL.Type == other.CRL.Type);
 }