Esempio n. 1
0
            /// <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);
            }
Esempio n. 2
0
        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.");
        }
Esempio n. 3
0
 /// <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);
 }