Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #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);
        }
Exemple #4
0
        public RopOutput create_output(long maxAlloc, int tag = 0)
        {
            int       ret  = (int)lib.rnp_output_to_memory(out RopHandle hnd, maxAlloc);
            RopOutput outp = new RopOutput(this, Util.PopHandle(lib, hnd, ret));

            PutObj(outp, tag);
            return(outp);
        }
Exemple #5
0
        public RopOutput create_output(object dummy = null, int tag = 0)
        {
            int       ret  = (int)lib.rnp_output_to_null(out RopHandle hnd);
            RopOutput outp = new RopOutput(this, Util.PopHandle(lib, hnd, ret));

            PutObj(outp, tag);
            return(outp);
        }
Exemple #6
0
        public RopOutput create_output(string toPath, int tag = 0)
        {
            int       ret  = (int)lib.rnp_output_to_path(out RopHandle hnd, toPath);
            RopOutput outp = new RopOutput(this, Util.PopHandle(lib, hnd, ret));

            PutObj(outp, tag);
            return(outp);
        }
Exemple #7
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);
        }
Exemple #8
0
        public RopOutput create_output(OutputCallBack outputCB, Object app_ctx, int tag = 0)
        {
            RopOutput outp = new RopOutput(this, outputCB);
            int       ret  = (int)lib.rnp_output_to_callback(out RopHandle hnd, outp, app_ctx);

            outp.Attach(Util.PopHandle(lib, hnd, ret));
            PutObj(outp, tag);
            return(outp);
        }
Exemple #9
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);
        }
Exemple #10
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);
        }
Exemple #11
0
        public RopOutput create_output(string toFile, bool overwrite, bool random, int tag = 0)
        {
            int flags = (overwrite? ROPD.RNP_OUTPUT_FILE_OVERWRITE : 0);

            flags |= (random? ROPD.RNP_OUTPUT_FILE_RANDOM : 0);
            int       ret  = (int)lib.rnp_output_to_file(out RopHandle hnd, toFile, (uint)flags);
            RopOutput outp = new RopOutput(this, Util.PopHandle(lib, hnd, ret));

            PutObj(outp, tag);
            return(outp);
        }
Exemple #12
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);
        }
Exemple #13
0
        // API

        public RopOutput output_to_armor(string type, int tag = 0)
        {
            int ret = (int)lib.rnp_output_to_armor(oid, out RopHandle hnd, type);

            if (own.TryGetTarget(out RopBind bind))
            {
                RopOutput arm = new RopOutput(bind, Util.PopHandle(lib, hnd, ret));
                bind.PutObj(arm, tag);
                return(arm);
            }
            throw new RopError(RopBind.ROP_ERROR_INTERNAL);
        }
Exemple #14
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);
        }
Exemple #15
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);
        }
Exemple #16
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);
        }
Exemple #17
0
 public void dump_packets_to_output_mpi(RopOutput output)
 {
     dump_packets_to_output(output, true, false, false);
 }
Exemple #18
0
 public void save_keys_secret(string format, RopOutput output)
 {
     save_keys(format, output, false, true);
 }
Exemple #19
0
 public void save_keys_public(string format, RopOutput output)
 {
     save_keys(format, output, true, false);
 }
Exemple #20
0
 public void dump_packets_to_output_grip(RopOutput output)
 {
     dump_packets_to_output(output, false, false, true);
 }
Exemple #21
0
 public RopOpSign op_sign_create_detached(RopInput input, RopOutput output)
 {
     return(op_sign_create(input, output, false, true));
 }
Exemple #22
0
 public RopOpSign op_sign_create_cleartext(RopInput input, RopOutput output)
 {
     return(op_sign_create(input, output, true, false));
 }
Exemple #23
0
        public void output_pipe(RopOutput output)
        {
            int ret = (int)lib.rnp_output_pipe(iid, output != null? output.getHandle() : RopHandle.Null);

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

            Util.Return(ret);
        }
Exemple #25
0
 public void export_secret(RopOutput output, bool subkey = false, bool armored = false)
 {
     export(output, false, true, subkey, armored);
 }