Question

I have a php code that gets a signature for a file using such a code

shell_exec("openssl smime -binary -sign".
    " -certfile '".$keyPath."/WWDR.pem'".
    " -signer '".$keyPath."/passcertificate.pem'".
    " -inkey '".$keyPath."/passkey.pem'".
    " -in '".$this->workFolder."/manifest.json'".
    " -out '".$this->workFolder."/signature'".
    " -outform DER -passin pass:'$pass'");

I need to have a pure managed C# code that would the same? Any idea how to do this? Thx

Was it helpful?

Solution

I had to go visit the OpenSSL docs to see what you are doing here, which appears to be signing document using PKCS#7.

While you could certainly continue to use OpenSSL and shell from .Net using Process.Start, there are better alternatives:

Perhaps someone whos more familiar with this than I can translate your OpenSSL statement verbatim. In the meantime, search google, msdn, and stackoverflow for stuff around these. There are plenty of samples, but it really depends on exactly you want to accomplish.

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