Пример #1
0
 /// <summary>
 /// Adds Key Recovery Agent (KRA) flags to enable on a specified Certification Authority. Multiple
 /// flags can be added at the time.
 /// </summary>
 /// <param name="flags">One or more flags defined in <see cref="KRAFlagEnum"/> enumeration.</param>
 /// <exception cref="ArgumentException">The data in the <strong>flags</strong> parameter
 /// contains Key Recovery Agent flags that are not supported by a current Certification Authority version.</exception>
 public void Add(KRAFlagEnum flags)
 {
     Int32[] existing = EnumFlags.GetEnabled(typeof(KRAFlagEnum), (Int32)KRAFlags);
     Int32[] newf     = EnumFlags.GetEnabled(typeof(KRAFlagEnum), (Int32)flags);
     if (version == CertSrvPlatformVersion.Win2003 && ((Int32)flags & (Int32)KRAFlagEnum.DisableUseDefaultProvider) != 0)
     {
         throw new ArgumentException();
     }
     foreach (Int32 item in newf)
     {
         if (!EnumFlags.Contains(existing, item))
         {
             KRAFlags  |= (KRAFlagEnum)item;
             IsModified = true;
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Adds Certificate Revocation List (CRL) flags to enable on a specified Certification Authority. Multiple
 /// flags can be added at the time.
 /// </summary>
 /// <param name="flags">One or more flags defined in <see cref="CRLFlagEnum"/> enumeration.</param>
 /// <exception cref="ArgumentException">The data in the <strong>flags</strong> parameter
 /// contains Certificate Revocation List flags that are not supported by a current Certification Authority version.</exception>
 public void Add(CRLFlagEnum flags)
 {
     Int32[] existing = EnumFlags.GetEnabled(typeof(CRLFlagEnum), (Int32)CRLFlags);
     Int32[] newf     = EnumFlags.GetEnabled(typeof(CRLFlagEnum), (Int32)flags);
     if (
         Version == "2000" ||
         Version == "2003" ||
         Version == "2008" &&
         ((Int32)flags & (Int32)CRLFlagEnum.DisableChainVerification) != 0 ||
         ((Int32)flags & (Int32)CRLFlagEnum.BuildRootCACRLEntriesBasedOnKey) != 0)
     {
         throw new ArgumentException();
     }
     foreach (int item in newf.Where(item => !EnumFlags.Contains(existing, item)))
     {
         CRLFlags   = (CRLFlagEnum)((Int32)CRLFlags + item);
         IsModified = true;
     }
 }
Пример #3
0
 /// <summary>
 /// Adds policy module flags to enable on a specified Certification Authority. Multiple
 /// flags can be added at the time.
 /// </summary>
 /// <param name="flags">One or more flags defined in <see cref="PolicyModuleFlagEnum"/> enumeration.</param>
 /// <exception cref="UninitializedObjectException">If the object is not initialized through one of the class constructors.</exception>
 /// <exception cref="ArgumentException">The data in the <strong>flags</strong> parameter
 /// contains policy module flags that are not supported by a current Certification Authority version.</exception>
 public void Add(PolicyModuleFlagEnum flags)
 {
     Int32[] existing = EnumFlags.GetEnabled(typeof(PolicyModuleFlagEnum), (Int32)EditFlags);
     Int32[] newf     = EnumFlags.GetEnabled(typeof(PolicyModuleFlagEnum), (Int32)flags);
     if (version == CertSrvPlatformVersion.Win2003 &&
         ((Int32)flags & (Int32)PolicyModuleFlagEnum.EnableOCSPRevNoCheck) != 0 ||
         ((Int32)flags & (Int32)PolicyModuleFlagEnum.EnableRenewOnBehalfOf) != 0
         )
     {
         throw new ArgumentException("This certification authority version do not support specified flag or flags.");
     }
     if (version == CertSrvPlatformVersion.Win2008 && ((Int32)flags & (Int32)PolicyModuleFlagEnum.EnableRenewOnBehalfOf) != 0)
     {
         throw new ArgumentException();
     }
     foreach (Int32 item in newf.Where(item => !EnumFlags.Contains(existing, item)))
     {
         EditFlags  = (PolicyModuleFlagEnum)((Int32)EditFlags + item);
         IsModified = true;
     }
 }