Exemplo n.º 1
0
        /// <summary>
        /// Copies a given KSwitchKeys instance to the current one.
        /// </summary>
        ///
        /// <param name="assign">The KSwitchKeys to copy from</param>
        /// <exception cref="ArgumentNullException">if assign is null</exception>
        public void Set(KSwitchKeys assign)
        {
            if (null == assign)
            {
                throw new ArgumentNullException(nameof(assign));
            }

            NativeMethods.KSwitchKeys_Set(NativePtr, assign.NativePtr);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new KSwitchKeys instance by copying a given instance.
        /// </summary>
        /// <param name="copy">The KSwitchKeys to copy from</param>
        /// <exception cref="ArgumentNullException">if copy is null</exception>
        public KSwitchKeys(KSwitchKeys copy)
        {
            if (null == copy)
            {
                throw new ArgumentNullException(nameof(copy));
            }

            NativeMethods.KSwitchKeys_Create(copy.NativePtr, out IntPtr ptr);
            NativePtr = ptr;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Check whether the given KSwitchKeys is valid for a given SEALContext. If the
        /// given SEALContext is not set, the encryption parameters are invalid, or the
        /// KSwitchKeys data does not match the SEALContext, this function returns false.
        /// Otherwise, returns true.
        /// </summary>
        /// <param name="kswitchKeys">The KSwitchKeys to check</param>
        /// <param name="context">The SEALContext</param>
        /// <exception cref="ArgumentNullException">if either kswitchKeys or context is null</exception>
        public static bool IsValidFor(KSwitchKeys kswitchKeys, SEALContext context)
        {
            if (null == kswitchKeys)
            {
                throw new ArgumentNullException(nameof(kswitchKeys));
            }
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            NativeMethods.ValCheck_KSwitchKeys_IsValidFor(kswitchKeys.NativePtr, context.NativePtr, out bool result);
            return(result);
        }