This article explains how to create an RFC5544-compliant timestamp over a piece of arbitrary data without signing it. If you are looking for information about timestamping digital signatures (CMS or CAdES), please consider this article instead.
With SecureBlackbox, RFC5544-based timestamping is performed with TElMessageTimestamper class (SBMessages namespace). TElMessageTimestamper only creates a proper message structure with embedded timestamps. It relies on timestamping components (such as TElHTTPTSPClient) to acquire the actual timestamp from a TSA service.
TElMessageTimestamper timestamper = new TElMessageTimestamper();
TElHTTPTSPClient tspClient = new TElHTTPTSPClient(); TElHTTPSClient httpClient = new TElHTTPSClient(); tspClient.HTTPClient = httpClient; tspClient.URL = "http://mytsaservice.com/tsa";
timestamper.TSPClient = tspClient;
timestamper.IncludeContent = true; timestamper.FileName = "myfile.txt";
timestamper.Timestamp(sourceStream, timestampedDataStream);That's it, the timestampedDataStream contains the timestamped data.
The timestamp request is created automatically by TElMessageSigner when you sign the data. All you have to do is create an event handler for the TElFileTSPClient.OnTimestampNeeded event (if you want to use custom timestamp processing), or set the TElHTTPTSPClient.URL property (if you want to use HTTP(S) transport). In the latter case, assign the transport (an instance of TElHTTPSClient) to TElHTTPTSPClient.HTTPClient property. Connection settings such as username and password could be specified via the TElHTTPSClient.RequestParameters property.
By default, no signing is performed if timestamping fails. This behavior can be modified by turning on the soIgnoreTimestampFailure option in the SigningOptions.