J
Joseph Geretz
I'm using the Request Filter documentation which can be found here:
http://msdn.microsoft.com/en-us/library/system.web.httprequest.filter.aspx
In this example, two filters are installed, one filter uppercases every
alphabetic character and then the second filter replaces every 'E' with "#'.
OK, very nice.
What's trivial about these examples is that the returned string is exactly
the same length as the string which is actually read from the Request
stream. I have a slightly more complicated situation where I'm using a
Filter to decrypt the data which is pulled from the Request stream. (I'm
implementing cryptography in the Filter so that application developers don't
need to worry about dealing with this issue; application developers simply
retrieve Request data and the filter ensures that it is always delivered in
PlainText, regardless of whether it was POSTed in cipher or plain text.)
So how do I deal with this issue, where the Request stream contains let's
say 2000 bytes, yet the decrypted plaintext is now only 1000 bytes? If I
return a count of 1000, then the Read event fires again, seemingly because
it appears as though there remains 1000 bytes to remove form the stream. If
I return the original count, then the buffer returned is much too large,
larger than the actual data which causes problems when attmepting to decrypt
the ciphertext. I'f you've ever developed such a scenario, I appreciate any
advice which you can provide.
Thanks!
- Joseph Geretz -
http://msdn.microsoft.com/en-us/library/system.web.httprequest.filter.aspx
In this example, two filters are installed, one filter uppercases every
alphabetic character and then the second filter replaces every 'E' with "#'.
OK, very nice.
What's trivial about these examples is that the returned string is exactly
the same length as the string which is actually read from the Request
stream. I have a slightly more complicated situation where I'm using a
Filter to decrypt the data which is pulled from the Request stream. (I'm
implementing cryptography in the Filter so that application developers don't
need to worry about dealing with this issue; application developers simply
retrieve Request data and the filter ensures that it is always delivered in
PlainText, regardless of whether it was POSTed in cipher or plain text.)
So how do I deal with this issue, where the Request stream contains let's
say 2000 bytes, yet the decrypted plaintext is now only 1000 bytes? If I
return a count of 1000, then the Read event fires again, seemingly because
it appears as though there remains 1000 bytes to remove form the stream. If
I return the original count, then the buffer returned is much too large,
larger than the actual data which causes problems when attmepting to decrypt
the ciphertext. I'f you've ever developed such a scenario, I appreciate any
advice which you can provide.
Thanks!
- Joseph Geretz -