public void can_sign_with_timestamp() { var timedsigner = new TimeStampSigner("testing"); var signed = timedsigner.Sign("hello world"); var unsigned = timedsigner.Unsign(signed); unsigned.ShouldBe("hello world"); }
public void tampering_with_timestamp_throws() { var timedsigner = new TimeStampSigner("testing"); var signed = timedsigner.Sign("hello world"); signed = signed.Substring(0, 15) + 3 + signed.Substring(15); Assert.Throws<BadSignatureException>(() => { var unsigned = timedsigner.Unsign(signed, 1); }); }
public void timestamp_age_check_works() { var timedsigner = new TimeStampSigner("testing"); var signed = timedsigner.Sign("hello world"); Trace.WriteLine(signed); System.Threading.Thread.Sleep(1100); Assert.Throws<SignatureExpiredException>(() => { var unsigned = timedsigner.Unsign(signed, 1); }); }