SecureTime API Toolkit
COM / .NET / C# Support 

DigiStamp RFC3161 digital timestamp using COM / .NET / C#
www.digistamp.com


DigiStamp C# support is provided via the Bouncy Castle C# API

The API is available for download here: http://www.bouncycastle.org/csharp/

Example code for retrieving a time stamp from DigiStamp using Bouncy Castle libraries.:

Retrieve a time stamp for your document in C#.
using Org.BouncyCastle.Tsp;
using Org.BouncyCastle.Math;

SHA1 sha1 = SHA1CryptoServiceProvider.Create();
byte[] hash = sha1.ComputeHash(Encoding.ASCII.GetBytes(data));

TimeStampRequestGenerator reqGen = new TimeStampRequestGenerator();
reqGen.SetCertReq(true);

TimeStampRequest tsReq = reqGen.Generate(TspAlgorithms.Sha1, hash, BigInteger.ValueOf(100)); byte[] tsData = tsReq.GetEncoded();

HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("http://tsatest.digistamp.com");
req.Method = "POST";
req.ContentType = "application/timestamp-query";
req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("9024:yourPass")));
req.ContentLength = tsData.Length;

Stream reqStream = req.GetRequestStream();
reqStream.Write(tsData, 0, tsData.Length);
reqStream.Close();

HttpWebResponse res = (HttpWebResponse) req.GetResponse();
if (res == null) { return false; }
else { Stream resStream = new BufferedStream(res.GetResponseStream());

TimeStampResponse tsRes = new TimeStampResponse(resStream); resStream.Close();

try {
tsRes.Validate(tsReq);
} catch (TspException e) {
Console.WriteLine(e.Message);
return false;
}
//saveresponse
}
There is additional example code here; about saving and verifying the timestamp.

Previous users of our retired, DigiStamp internal C# version:

August 2008 UPDATE - our toolkit was discontinued and we now encourage customers to use a Bouncy Castle client solution for the .NET environment as described above.

New customers should use the above BouncyCastle method. Existing customers should migrate to the Bouncy Castle method as convenient.

This document contains information on how to install the DigiStamp COM dll and use the corresponding NET, C# examples and VB application.

You will need to establish an account with Digistamp to request time stamps from the server. Account set-up is at the www.digistamp.com web site.

The toolkit library allows adding time stamping capability to your existing application. The toolkit performs the functions:

The client has several options for how to access this functionality:

  1. C# .NET access via a COM object wrapper (TlbImp generated proxy)
  2. C# .NET access via an import of the COM object
  3. COM object
  4. C / C++
  5. Java

From the list above, options 1,2 and 3 are included in this toolkit package. The C/C++ and Java options are available from DigiStamp in different toolkit packages.

Summary:

The time stamp functions are best described in the foundation C toolkit. This documentation has been provided here: API description.

C# and .NET access is a relatively new implementation for DigiStamp and is still considered Beta (February 2005). We have tried to resolve the complexity by providing examples. With your feedback, DigiStamp can develop improved solutions to help .NET/C# users - so, please write and give us your thoughts. For example, we are exploring these concepts: - .NET Wrapper - Managed Extensions to C++. - global assembly cache (GAC)- VS registered


Support Requests, Bug Reports, and Requests for Enhancements

Internet Email: support@digistamp.com

Installing the COM object .dll

Once you have unzip the zip file into your chosen folder, change directory to register the SecureTime.dll. Both a debug and release version have been provided under the "lib" directory. Enter the following command:

regsvr32 SecureTime.dll

This will register the SecureTime COM dll and it can now be used by any COM enabled client application, such as the sample VB application supplied with this toolkit.

Environment options:
Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0 SP4 and later.
Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0 SP4 and later, Windows Me, or Windows 98
Windows 95 with Internet Explorer 3.02 or later
Requires crypt32.lib in path.

Installing x.509 certificate for time stamp verification

Before running the sample programs make sure that all necessary certificates are installed on your machine. In order to get these certificates go to DigiStamp web site at www.digistamp.com. Once you have downloaded the current certificates install these certificates on your machine. As you are going through the installation of the certificates make sure that Time Stamp certificates are installed in the personal folder. See extended description at: www.digistamp.com/subpage/corporate-and-software-developers/

Sample applications

VB-COM

To run the VB-COM sample program the TestTimeStamp.exe has been provided. Or, bring up Visual Basic and open a TestTimeStamp project. To make sure VB has access to the SecureTime COM dll, go to the Project->References menu and verify the SecureTime Type Library is checked. The sample program also uses the Microsoft Scripting Runtime library, so make sure it is checked as well and click OK.

You can then press the Start button on the VB toolbar to run the sample program. The form contains an entry field for your DigiStamp account ID and password. Then press the Initialize button, followed by Request, and then Verify. The text box should display debug messages as each method is executed. Press the End button on the VB toolbar (or the Close button on the form) to stop the sample program. Select the View->Code menu to see the documented source code for the sample application.

C# .NET

Within these examples are two different approach for access the COM object.
1. "Using Proxy" - this uses the COM wrapper.
2. "No Proxy" - this imports the COM object.
Both of these example types use a wrapper that encapsulates the functionality of our underlying C modules
To examine the different approaches, focus on the different "SecureTime_CSWrapper" in the two directory structures (UsingProxy versus NoProxy).
You can use the ".EXE" files in the bin directory to test the samples that we have provided. For example:
\DotNetSampleNoProxy\SecureTime_CSNetClient\bin\DebugSecureTime_CSNetClient.exe
We built and tested both samples in VB.Net and C# under VS.Net 2002 .Net Framework 1.0. If you would want to try with VS.Net 2003, then VS will prompt you to convert the solution and projects format to the new one. Just open the SecureTime_NetClient solution.

Change History

August 28 2010 DigiStamp development stops. Support for existing customers continues. New customers are referred to the BouncyCastle solution.

January 28 2005 version 2 release. Primary changes are to incorporate .NET "no proxy" approach and provide improved examples.

January 2004 first beta release of the .NET C# access approaches

March 2003 COM object released

August 27, 2000 first alpha release of the COM object