.NET library for creating and verifying RFC 3161 timestamps. Based on Bouncy Castle. Available on NuGet.
TimestampCreator creator = new TimestampCreator();
TimestampObject timestamp = creator
.SetTsaPrimaryUrl("http://example.com/tsa")
.SetDataForTimestamping("Example.pdf")
.CreateTimestamp();
TimestampVerifier verifier = new TimestampVerifier();
TimestampObject verifiedTimestamp = verifier
.SetTimestampedData("Example.pdf")
.SetTimestamp(timestamp.Timestamp)
.Verify();
Items highlighted in bold are mandatory. For further info see ITimestampCreator and ITimestampVerifier interfaces.
- Primary TSA url - (string)
- Hash algorithm - (HashAlgorithm enum value)
- Data to be timestamped
- File - (byte[], stream, string)
- List of files - (byte[][], stream[], string[])
- Message digest(s) - (byte[], byte[][])
- Output format - (OutputFormat enum value)
- Secondary TSA url - (string)
- Primary and secondary TSA credentials - (string)
- TSA connection timeout - (int)
- Minimum certificate validity period - (int)
- Timestamp
- TSR format
- ASIC-S format
- Additional info (generated time, hash algorithm, signer info, ...)
- Timestamp - (string, byte[], stream)
- Hash algorithm - (HashAlgorithm enum value)
- Timestamped data
- File - (byte[], stream, string)
- List of files - (byte[][], stream[], string[])
- Message digest(s) - (byte[], byte[][])
- Minimum certificate validity period - (int)
- Timestamp
- TSR format
- ASIC-S format
- Additional info (generated time, hash algorithm, signer info, ...)
Utils.LoadConfigurationFile("path/to/configuration/file.txt");
Several data, required for working with timestamps, can be provided through configuration file. Static data that doesn’t change, such as credentials to access TSA, can be retrieved from this file. This way the user doesn't have to specify these settings every time he wants to create or verify a timestamp. The configuration file is a simple text file. Each row contains exactly one key-value pair of settings separated with equals sign (example: hash.algorithm=sha1).
Configuration name | Description | Value |
---|---|---|
tsa.primary.url | Url address of primary TSA | |
tsa.primary.username | Username for accessing protected TSA | |
tsa.primary.password | Password for accessing protected TSA | |
tsa.secondary.url | Url address of secondary TSA | |
tsa.secondary.username | Username for accessing protected TSA | |
tsa.secondary.password | Password for accessing protected TSA | |
tsa.timeout | TSA connection timeout limit (milliseconds) | |
hash.algorithm | Hash algorithm used to create message digest | MD5/SHA1/SHA256/SHA512 |
timestamp.output | Specifies format of timestamp that is returned | TSR/ASICS |
certificate.minimum.validity | Minimum time period when signing certificate has to be valid (days) |