public void TestVerifyTimestampUsingConfiguration() { byte[] data = Encoding.UTF8.GetBytes(dataToTimestamp); TimestampCreator creator = new TimestampCreator(); TimestampObject timestamp = creator .SetDataForTimestamping(data) .CreateTimestamp(); Assert.AreEqual(HashAlgorithm.SHA1, timestamp.HashAlgorithm); TimestampVerifier verifier = new TimestampVerifier(); TimestampObject verifiedTimestamp = verifier.SetTimestampedData(data) .SetTimestamp(timestamp.Timestamp) .Verify(); }
public void TestCreateTimestampUsingConfigurationFile() { byte[] data = Encoding.UTF8.GetBytes(dataToTimestamp); Utils.LoadConfigurationFile(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + "\\src\\configuration.txt"); TimestampCreator creator = new TimestampCreator(); TimestampObject timestamp = creator .SetDataForTimestamping(data) .CreateTimestamp(); Assert.AreEqual(HashAlgorithm.SHA1, timestamp.HashAlgorithm); timestamp = creator .SetHashAlgorithm(HashAlgorithm.SHA256) .CreateTimestamp(); Assert.AreEqual(HashAlgorithm.SHA256, timestamp.HashAlgorithm); }