Пример #1
0
        /// <summary>
        /// Factory method that calls XXX() to deserialize
        /// a DH object from a DER-formatted buffer using the BIO interface.
        /// </summary>
        /// <param name="bio"></param>
        /// <returns></returns>
        public static DH FromParametersDER(BIO bio)
        {
            DH_new_delegate       dh_new       = new DH_new_delegate(Managed_DH_new);
            d2i_DHparams_delegate d2i_DHparams = new d2i_DHparams_delegate(Managed_d2i_DHparams);
            IntPtr dh_new_ptr       = Marshal.GetFunctionPointerForDelegate(dh_new);
            IntPtr d2i_DHparams_ptr = Marshal.GetFunctionPointerForDelegate(d2i_DHparams);
            IntPtr ptr = Native.ExpectNonNull(Native.ASN1_d2i_bio(dh_new_ptr, d2i_DHparams_ptr, bio.Handle, IntPtr.Zero));
            DH     dh  = new DH(ptr, true);

            return(dh);
        }