See the question and my original answer on StackOverflow

You need to write a custom HTTP Timestamp server. It should follow RFC 3161 Time-Stamp Protocol (TSP) rules.

When you sign your DLL for authenticode with a tool such as Signtool.exe from the Windows SDK, you can specify the url of the timestamp server (with the /t swich. See also /tr and /td). You would then point to your server.

See here on SO for a related question: Trusted Timestamps - understanding the format (rfc3161)

and also: Alternative timestamping services for Authenticode