How to call the restic exe from backup agent securely

Dear All,
I am working on creating enablers in .NET Core6. From our modules, we need to pass our parameters to Restic as command line arguments.
Is it possible to securely pass arguments to a command line tool(Restic) from C# code?
Would like to know how we can consume Restic binary from C# project?
Any suggestions please. Appreciated, thanks.

I’m kinda potato on C# and .Net environment. But what do you mean by “secure”? What is insecure about just passing the parameters as command line arguments? Don’t you trust the client? If yes, it’s not about the secrets you’d like to hide which you can pass to the binary, it’s about the restrictions you can put to these secrets/credentials. E.g. you can use rest server with an append-only key.

For things like the repo password its probably better to use environment variables instead of command line argument (although I’m not 100% sure about the access restrictions for the on Windows(?)).

Several restic commands provide json output when using the --json flag. The text output of restic is not guaranteed to be stable, if you need to parse it please use the json format. For the JSON format we try to maintain compatibility, but not for the text output.