Sign PDF document with a time stamp

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Signature MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →

GroupDocs.Signature can add a trusted time stamp to a PDF digital signature. The time stamp comes from a time-stamp authority (TSA) that implements RFC 3161. It proves when the document was signed, which matters once the signing certificate expires: a validator can then check that the certificate was valid at the signing time.

Here are the steps to sign a PDF document with a time stamp:

using (Signature signature = new Signature("sample.pdf"))
{
    PdfDigitalSignature pdfDigitalSignature = new PdfDigitalSignature()
    {
        // The time-stamp authority to contact. The user name and password are optional:
        // set either, both or neither, depending on what the time-stamp authority requires.
        TimeStamp = new TimeStamp("https://freetsa.org/tsr", "", "")
    };

    DigitalSignOptions options = new DigitalSignOptions("certificate.pfx")
    {
        Password = "1234567890",
        Signature = pdfDigitalSignature
    };

    signature.Sign("signed.pdf", options);
}

How the time stamp is requested

  • The time-stamp authority is contacted while the document is signed, so the signing machine must be able to reach it. The request contains a hash of the signature, not the document.
  • The time stamp uses the same digest as the signature: SHA-256 by default, or the value of HashAlgorithm.
  • The user name and password are sent with HTTP Basic authentication, so use an https:// address. Starting with GroupDocs.Signature for .NET 26.9, they are sent when either of them is set; earlier versions sent them only when both were set.
  • If the time-stamp authority cannot be reached or rejects the request, Sign throws GroupDocsSignatureException and the document is not signed.
  • Time stamps are available for PDF documents.

See Network access and data privacy for every situation in which GroupDocs.Signature uses the network.

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured .NET library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.