Hi Stephane,
We were able to use Crypto API to sign an executable programmatically, however it still requires generating file on the disk first.
We’re now trying to do the same, but using memory blob, but can’t get it to work as yet. We’ve trying to get an answer from the community:
I wonder if you could do one more test (as on our tests McAfee does not quarantines executable when it’s written to the disk, only when you try to run it):
Could you try generating file with different extension to see if this still triggers antivirus protection? Here’s a sample code how this can be done with ScriptRun - it will generate .xxx file when you call Compile:
public class SignedRoslynScriptHost : RoslynScriptHost
{
public SignedRoslynScriptHost(IScriptRun scriptRun)
: base(scriptRun)
{
}
protected override RoslynScriptProvider CreateScriptEngine()
{
RoslynScriptProvider engine = base.CreateScriptEngine();
if (engine != null)
{
engine.AssemblyPath = AssemblyPath;
engine.AssemblyFileName = System.IO.Path.ChangeExtension(AssemblyFileName, "xxx");
}
return engine;
}
}
public class SignedScriptRun : ScriptRun
{
public override IScriptHost CreateScriptHost()
{
return new SignedRoslynScriptHost(this);
}
}
}
If this succeeds, we might be able to generate temp file (with some other extension, then sign it, then rename it to .exe)?
Regards,
Dmitry