/// <summary> /// Prefixes the data then signs it. /// </summary> /// <param name="signingStream">The signing stream.</param> /// <param name="extra">The extra data passed by prefixData.</param> protected override void PrefixDataSign(HashingStream signingStream, object extra) { base.PrefixDataSign(signingStream, extra); var expiration = FromDateTime((DateTime)extra); var buffer = Utility.GetBytes(expiration); signingStream.Write(buffer, 0, buffer.Length); }
public void CannotWriteForReadMode() { // Arrange var hashing = new HashingStream(new MemoryStream(), SHA1.Create(), true); // Act, Assert Action action = () => hashing.Write(new byte[1], 0, 1); action.ShouldThrow <NotSupportedException>().Which.Message.Should().Be("The hashing stream is configured to read, not write."); }
/// <summary> /// Postfixes the data then signs it. /// </summary> /// <param name="signingStream">The signing stream.</param> /// <param name="extra">The extra data passed by postfixData.</param> protected virtual void PostfixDataSign(HashingStream signingStream, object extra) { signingStream.Write(FormatBytes, 0, FormatBytes.Length); }