Question

I have a file that i have as an embedded resource in my C# program. I need to read this resource and then pass it to an external exe via the System.Diagnostics.Process.Start() command. The external exe wants the resource path to its location in the OS. Is there a way to pass it as a stream or something like that? Or am i going to have to write it to a temporary file then send the file path to the external exe?

The embedded resource is certificate file external exe is signtool. So due to the sensitive nature i'd like to try and not write the resource to the system.

Is this possible?

Was it helpful?

Solution

You could write the certificate to a file in encrypted Personal Information Exchange (PFX) format, and then pass the file path and password to signtool on the command line.

OTHER TIPS

No, that's not immediately possible. The EXE that you invoke would have to be written differently, and there's no easy way to pass a handle from one process to another like this anyway.

Depending on a tool you may be able to pass file as input (text only) similar to CMD's "pipe" (|) option. This approach possible only for tools that take standard input as source for data (i.e. most find and replace tools including findstr built into Windows).

Otherwise - no.

Note that if you have certificate as part of your application (embedded resource) it is already present on the disk. There is not much difference to save it separately for short time to let other tool to use it. If you really need to protect them - have separate machine in secure place dealing with signing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top