Exemplo n.º 1
0
 internal static extern int gpgme_op_card_edit(
     [In] IntPtr ctx,
     [In] IntPtr key,          //gpgme_key_t
     [In] gpgme_edit_cb_t fnc, //gpgme_edit_cb_t
     [In] IntPtr fnc_value,    //void *
     [In] IntPtr outdata       //gpgme_data_t
     );
 internal extern static int gpgme_op_edit_start(
     [In] IntPtr ctx,
     [In] IntPtr key,          // gpgme_key_t
     [In] gpgme_edit_cb_t fnc, // gpgme_edit_cb_t
     [In] IntPtr fnc_value,    // void *
     [In] IntPtr outdata       // gpgme_data_t
     );
Exemplo n.º 3
0
        protected int StartEdit(Context ctx, IntPtr handle, GpgmeData data)
        {
            if (KeyPtr == IntPtr.Zero)
            {
                throw new InvalidKeyException();
            }

            if (ctx == null || !(ctx.IsValid))
            {
                throw new InvalidContextException();
            }

            if (data == null || !(data.IsValid))
            {
                throw new InvalidDataBufferException();
            }

            lock (editlock)
            {
                LastCallbackException = null;

                // set the instance's _edit_cb() method as callback function for libgpgme
                _instance_key_edit_callback = new gpgme_edit_cb_t(_edit_cb);

                // start key editing
                int err = libgpgme.gpgme_op_edit(
                    ctx.CtxPtr,
                    KeyPtr,
                    _instance_key_edit_callback,
                    handle,
                    data.dataPtr);

                GC.KeepAlive(_instance_key_edit_callback);

                if (LastCallbackException != null)
                {
                    throw LastCallbackException;
                }

                return(err);
            }
        }
Exemplo n.º 4
0
        protected int StartEdit(Context ctx, IntPtr handle, GpgmeData data)
        {
            if (KeyPtr == IntPtr.Zero)
                throw new InvalidKeyException();

            if (ctx == null || !(ctx.IsValid))
                throw new InvalidContextException();

            if (data == null || !(data.IsValid))
                throw new InvalidDataBufferException();

            lock (editlock)
            {
                LastCallbackException = null;

                // set the instance's _edit_cb() method as callback function for libgpgme
                _instance_key_edit_callback = new gpgme_edit_cb_t(_edit_cb);

                // start key editing
                int err = libgpgme.gpgme_op_edit(
                    ctx.CtxPtr,
                    KeyPtr,
                    _instance_key_edit_callback,
                    handle,
                    data.dataPtr);

                GC.KeepAlive(_instance_key_edit_callback);

                if (LastCallbackException != null)
                    throw LastCallbackException;

                return err;
            }
        }