コード例 #1
0
ファイル: KSwitchKeys.cs プロジェクト: zygabyte/SEAL
        /// <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);
        }
コード例 #2
0
ファイル: KSwitchKeys.cs プロジェクト: zygabyte/SEAL
        /// <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;
        }
コード例 #3
0
ファイル: ValCheck.cs プロジェクト: philippejohns/SEAL
        /// <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);
        }