/// <summary> /// Removes Key Recovery Agent (KRA) flags from a specified Certification Authority. Multiple /// flags can be removed at the time. /// </summary> /// <param name="flags">One or more flags defined in <see cref="KRAFlagEnum"/> enumeration.</param> public void Remove(KRAFlagEnum flags) { Int32[] existing = EnumFlags.GetEnabled(typeof(KRAFlagEnum), (Int32)KRAFlags); Int32[] newf = EnumFlags.GetEnabled(typeof(KRAFlagEnum), (Int32)flags); foreach (Int32 item in newf) { if (EnumFlags.Contains(existing, item)) { KRAFlags = (KRAFlagEnum)((Int32)KRAFlags - item); IsModified = true; } } }
/// <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; } } }