Exemplo n.º 1
0
        public void export_autocrypt(RopKey subkey, string uid, RopOutput output)
        {
            RopHandle subk = (subkey != null? subkey.getHandle() : RopHandle.Null);
            RopHandle outp = (output != null? output.getHandle() : RopHandle.Null);
            int       ret  = (int)lib.rnp_key_export_autocrypt(kid, subk, uid, outp, 0);

            Util.Return(ret);
        }
Exemplo n.º 2
0
        public RopSignSignature add_signature(RopKey key)
        {
            int ret = (int)lib.rnp_op_encrypt_add_signature(opid, key != null? key.getHandle() : null, out RopHandle hnd);

            if (own.TryGetTarget(out RopBind bind))
            {
                return(new RopSignSignature(bind, Util.PopHandle(lib, hnd, ret)));
            }
            throw new RopError(RopBind.ROP_ERROR_INTERNAL);
        }
Exemplo n.º 3
0
        public String request_password(RopKey key, object context)
        {
            RopHandle hkey = (key != null? key.getHandle() : RopHandle.Null);
            int       ret  = (int)lib.rnp_request_password(sid, hkey, context, out RopHandle ps);
            RopHandle psw  = Util.PopHandle(lib, ps, ret);
            String    spsw = RopHandle.Str(psw);

            psw.ClearMemory();
            lib.rnp_buffer_destroy(psw);
            return(spsw);
        }
Exemplo n.º 4
0
        // API

        public void add_recipient(RopKey key)
        {
            int ret = (int)lib.rnp_op_encrypt_add_recipient(opid, key != null? key.getHandle() : null);

            Util.Return(ret);
        }
Exemplo n.º 5
0
        public RopOpGenerate op_generate_create(string keyAlg, RopKey primary = null, int tag = 0)
        {
            int       ret;
            RopHandle op = null;

            if (primary == null)
            {
                ret = (int)lib.rnp_op_generate_create(out op, sid, keyAlg);
            }
            else
            {
                ret = (int)lib.rnp_op_generate_subkey_create(out op, sid, primary != null? primary.getHandle() : RopHandle.Null, keyAlg);
            }
            if (own.TryGetTarget(out RopBind bind))
            {
                RopOpGenerate opg = new RopOpGenerate(bind, Util.PopHandle(lib, op, ret));
                bind.PutObj(opg, tag);
                return(opg);
            }
            throw new RopError(RopBind.ROP_ERROR_INTERNAL);
        }