I have to write an .NET application that should be exportable to .NET Framework 4.0.x, .NET Standard 2.0, and .NET Core 2.2 that is able to sign .NET assemblies (EXE, DLL) using the Authenticode "format" with X509Certificate2 objects.
So far, I have found solutions which are utilizing the SignTool application, or CryptUIWizDigitalSign API which uses the SignerSignEx API. Both methods are not compatible with the project requirements. The assembly may be exportable to the targets mentioned in the first paragraph, but are not working with a different operating system than Windows XP and above, or with Windows XP and above non-desktop installations.
I know how I simply create signatures for blobs using .NET Framework/Standard/Core managed code, but simply appending the signature to an assembly would break the whole assembly since there is no Authenticode markup.
Is there any Authenticode documentation on how the format is designed, so I can reimplement the format with managed code? What about the timestamping which is included in the Authenticode standard?
Or is there already a managed solution available, and I simply didn't found it yet?
The application has to be written in VB.NET or C#. So hints for both language are welcome.