Example #1
0
        public RopOpSign op_sign_create(RopInput input, RopOutput output, bool cleartext = false, bool detached = false, int tag = 0)
        {
            int       ret  = ROPE.RNP_SUCCESS;
            RopHandle inp  = (input != null? input.getHandle() : RopHandle.Null);
            RopHandle outp = (output != null? output.getHandle() : RopHandle.Null);
            RopHandle op   = null;

            if (cleartext)
            {
                ret = (int)lib.rnp_op_sign_cleartext_create(out op, sid, inp, outp);
            }
            else if (detached)
            {
                ret = (int)lib.rnp_op_sign_detached_create(out op, sid, inp, outp);
            }
            else
            {
                ret = (int)lib.rnp_op_sign_create(out op, sid, inp, outp);
            }
            if (own.TryGetTarget(out RopBind bind))
            {
                RopOpSign sign = new RopOpSign(bind, Util.PopHandle(lib, op, ret));
                bind.PutObj(sign, tag);
                return(sign);
            }
            throw new RopError(RopBind.ROP_ERROR_INTERNAL);
        }
Example #2
0
        public void export_revocation(RopOutput output, string hash, string code, string reason)
        {
            RopHandle outp = (output != null? output.getHandle() : RopHandle.Null);
            int       ret  = (int)lib.rnp_key_export_revocation(kid, outp, 0, hash, code, reason);

            Util.Return(ret);
        }
Example #3
0
        public void decrypt(RopInput input, RopOutput output)
        {
            RopHandle inp  = (input != null? input.getHandle() : RopHandle.Null);
            RopHandle outp = (output != null? output.getHandle() : RopHandle.Null);
            int       ret  = (int)lib.rnp_decrypt(sid, inp, outp);

            Util.Return(ret);
        }
Example #4
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);
        }
Example #5
0
        public void save_keys(string format, RopOutput output, bool pub = true, bool sec = true)
        {
            RopHandle outp  = (output != null? output.getHandle() : RopHandle.Null);
            int       flags = (pub? ROPD.RNP_LOAD_SAVE_PUBLIC_KEYS : 0);

            flags |= (sec? ROPD.RNP_LOAD_SAVE_SECRET_KEYS : 0);
            int ret = (int)lib.rnp_save_keys(sid, format, outp, (uint)flags);

            Util.Return(ret);
        }
Example #6
0
        public void dump_packets_to_output(RopOutput output, bool mpi = false, bool raw = false, bool grip = false)
        {
            int flags = (mpi? ROPD.RNP_DUMP_MPI : 0);

            flags |= (raw? ROPD.RNP_DUMP_RAW : 0);
            flags |= (grip? ROPD.RNP_DUMP_GRIP : 0);
            int ret = (int)lib.rnp_dump_packets_to_output(iid, output != null? output.getHandle() : RopHandle.Null, (uint)flags);

            Util.Return(ret);
        }
Example #7
0
        public void export(RopOutput output, bool pub = true, bool sec = true, bool subkey = false, bool armored = false)
        {
            RopHandle outp  = (output != null? output.getHandle() : RopHandle.Null);
            int       flags = (pub? ROPD.RNP_KEY_EXPORT_PUBLIC : 0);

            flags |= (sec? ROPD.RNP_KEY_EXPORT_SECRET : 0);
            flags |= (subkey? ROPD.RNP_KEY_EXPORT_SUBKEYS : 0);
            flags |= (armored? ROPD.RNP_KEY_EXPORT_ARMORED : 0);
            int ret = (int)lib.rnp_key_export(kid, outp, (uint)flags);

            Util.Return(ret);
        }
Example #8
0
        public RopOpEncrypt op_encrypt_create(RopInput input, RopOutput output, int tag = 0)
        {
            RopHandle inp  = (input != null? input.getHandle() : RopHandle.Null);
            RopHandle outp = (output != null? output.getHandle() : RopHandle.Null);
            int       ret  = (int)lib.rnp_op_encrypt_create(out RopHandle op, sid, inp, outp);

            if (own.TryGetTarget(out RopBind bind))
            {
                RopOpEncrypt ope = new RopOpEncrypt(bind, Util.PopHandle(lib, op, ret));
                bind.PutObj(ope, tag);
                return(ope);
            }
            throw new RopError(RopBind.ROP_ERROR_INTERNAL);
        }
Example #9
0
        public RopOpVerify op_verify_create(RopInput input, RopOutput output, RopInput signature = null, int tag = 0)
        {
            RopHandle inp = (input != null? input.getHandle() : RopHandle.Null);
            int       ret;
            RopHandle op = null;

            if (signature == null)
            {
                RopHandle outp = (output != null? output.getHandle() : RopHandle.Null);
                ret = (int)lib.rnp_op_verify_create(out op, sid, inp, outp);
            }
            else
            {
                RopHandle sig = (signature != null? signature.getHandle() : RopHandle.Null);
                ret = (int)lib.rnp_op_verify_detached_create(out op, sid, inp, sig);
            }
            if (own.TryGetTarget(out RopBind bind))
            {
                RopOpVerify opv = new RopOpVerify(bind, Util.PopHandle(lib, op, ret));
                bind.PutObj(opv, tag);
                return(opv);
            }
            throw new RopError(RopBind.ROP_ERROR_INTERNAL);
        }
Example #10
0
        public void output_pipe(RopOutput output)
        {
            int ret = (int)lib.rnp_output_pipe(iid, output != null? output.getHandle() : RopHandle.Null);

            Util.Return(ret);
        }
Example #11
0
        public void dearmor(RopOutput output)
        {
            int ret = (int)lib.rnp_dearmor(iid, output != null? output.getHandle() : RopHandle.Null);

            Util.Return(ret);
        }
Example #12
0
        public void enarmor(RopOutput output, string type)
        {
            int ret = (int)lib.rnp_enarmor(iid, output != null? output.getHandle() : RopHandle.Null, type);

            Util.Return(ret);
        }