This object implements a stream filter that can Hash/HMAC data
while it is read/written through it. This object is feasible when the
application uses various streams extensively and if it will be
beneficial to leave some parts of the application unaware of the Hash/HMAC
generation. If that is not the case the excess code needed to
initialize and manage the object will not be justified.
|
ReadReset
WriteReset |
Syntax:
object.ReadReset
object.WriteReset
Resets the Write or the Read processor of the object
respectively. Leaves the selected algorithm and Key (if any)
intact. |
|
WriteHashEnable
ReadHashEnable |
Syntax:
object.WriteHashEnable = b
b = object.WriteHashEnable
object.ReadHashEnable = b
b = object.ReadHashEnable
Boolean. Enables the Read or the Write processor of the object
respectively. Using this property you can disable/enable the data
processing as needed. For example you may want to transfer some data
through the stream filter without generating a digest over it. By
default the both processors are disabled!
|
|
WriteResetKey
ReadResetKey |
Syntax:
object.WriteResetKey
object.ReadResetKey
Resets the Write or the Read processor of the object
respectively. Leaves the selected algorithm intact, but clears the
Key. |
|
WriteFinalize
ReadFinalize |
Syntax:
object.WriteFinalize
object.ReadFinalize
Finalizes the digest for the Read or the Write processor
respectively. The processing occurs like this:
The SFStreamDigest stream filter is attached to another stream and
the stream filter is driven through a SFStream
object. When the application completes with the transfer of a data
over which a hash needs to be generated it calls WriteFinalize or
ReadFinalize (depending on the direction in which the data is
transfered) and collects the digest from the ReadValue/WriteValue
or ReadBinaryValue/WriteBinaryValue properties. Then the
application can continue with the transfer of another data over
which another digest can be generated. |
|
SeekingForbidden |
Syntax:
object.SeekingForbidden = b
b = object.SeekingForbidden
Boolean. By default it is True. True in this property denies
any position changing operations over the stream (if it is
seekable of course - if it is not they are not possible anyway).
When a digest is generated it is important to keep the data
consistency, allowing the code that drives the stream filter
through SFStream to reposition anywhere in the stream usually
means that the consistency will be compromised (i.e. transfer 20
bytes from the beginning of the file, then jump to the middle and
transfer some bytes from there etc.). Thus usually the object
would keep you from mistakes by issuing an error when the position
is changed. However you can disable the processor (Both or one of
them) for some time and you may want to be able to jump through
the file during that time. Or there is also another possibility -
the file may contain the data you want to transfer spread in
different locations of the file. It is up to you to determine when
the re-positioning operations will not harm the data consistency
and consequently the digest generation. Setting the property to
False during these periods will enable the seeking features (SFStream.Pos
for example).
Please note that the described technique is usually typical for
complex file structures. It is not recommended to enable the file
seeking unless you really need it. |
|
CodePage |
Syntax:
object.CodePage = cp
cp = object.CodePage
|
|
Stream |
Syntax:
Set object.Stream = strm
Set strm = object.Stream
Sets gets the stream to which the filter is attached. Generally
it is possible to attach more than one filter over a real stream
(i.e. this can be another filter - for example a SFStreamCrypt you
use to decrypt the real stream underneath). However, most often
this is a "real" stream such as a file, network
connection and so on. |
|
ReadAlgorithm
WriteAlgorithm |
Syntax:
object.ReadAlgorithm = alg
alg = object.ReadAlgorithm
object.WriteAlgorithm = alg
alg = object.WriteAlgorithm
Initializes the respective processor with the algorithm
specified. The algorithms have the same names as in HashObject.InitHash. |
|
WriteKey
ReadKey |
Syntax:
object.ReadKey = key
key = object.ReadKey
object.WriteKey = key
key = object.WriteKey
Specifies HMAC key for the Read or the Write processor
respectively. See HashObject.Key
for more comments about HMAC. |
|
ReadBinaryValue
WriteBinaryValue |
Syntax:
v = object.ReadBinaryValue
v = object.WriteBinaryValue
|
|
ReadValue
WriteValue |
Syntax:
v = object.ReadValue
v = object.WriteValue
|
...