Thread View: news.software.nntp
19 messages
19 total messages
Started by Kjetil Torgrim Homme
Sat, 11 Jan 2003 03:28
Content-SHA1-Tree
Author: Kjetil Torgrim Homme
Date: Sat, 11 Jan 2003 03:28
Date: Sat, 11 Jan 2003 03:28
113 lines
6285 bytes
6285 bytes
I thought I'd try my hand at writing a specification of
Content-SHA1-Tree, but before foisting it on the MIME people, I guess
it's best that people here (at least Curt) has a look at it and sees
that it is right.
----- begins -----
Content-SHA1-Tree is a header which is used to verify the correct
transfer of a file. It differs from most other hashes in that it can
verify individual fragments of a file, with only the information
included in this header and the fragment itself.
The basic principle is to create an identifying hash which builds on a
tree of hashes. The file is split into blocks and the data in each
block is hashed, using SHA1 as the hashing algorithm.
+--------+--------+--------+--------+-- - - --+--------+
| block1 | block2 | block3 | block4 | | block8 |
+--------+--------+--------+--------+-- - - --+--------+
| | | | |
v v v v v
hash1 hash2 hash3 hash4 ... hash8
Each hashN is a 160 bits value. Concatenate hash1 and hash2, and run
SHA1 on those 320 bits. Let's call the resulting hash value hash12.
Do the same for hash3 and hash4, etc. Now move up a level, and run
SHA1 on the concatenation of hash12 and hash34, etc. Finally,
concatenate hash1234 and hash5678, run SHA1 on it. The result is the
hash used to identify the file.
hash1 hash2 hash3 hash4 hash5 hash6 hash7 hash8
| | | | | | | |
+---+---+ +---+---+ +---+---+ +---+---+
| | | |
hash12 hash34 hash56 hash78
| | | |
+-------+-------+ +-------+-------+
| |
hash1234 hash5678
| |
+---------------+---------------+
|
identifying hash
If we have all the data and the identifying hash, it is easy to verify
that the hash matches. If we only have some of the data (and the
identifying hash), we need either more data, or more hashes. Let's
say the file in question was split in three, with the first fragment
containing three blocks. It is easy to calculate hash1, hash2, hash3
and hash12 from the data, but then we're stuck. To continue the
calculation, we need hash4. Now we can calculate hash34 and hash1234.
If we're supplied with hash5678 as well, the identifying hash can be
verified. Hence, the first fragment only needs the hashes hash4 and
hash5678 to verify that the first three blocks are a genuine part of
the complete file.
To complete the example: Fragment 2, containing blocks 4, 5 and 6,
needs hashes hash12, hash3 and hash78. The last fragment needs hashes
hash1234 and hash56.
In order to fool this algorithm into verifying false data, you would
have to find a (false) value for hash5678, which, when hashed with the
hash1234 calculated from the false data, gives the identifying hash as
its answer. SHA1 is considered a cryptographically secure hash, that
is, there is no known way to create data which produces a given hash.
With current technology, this requires a brute force attack in a 160
bits namespace, and there isn't even any guarantee that the wanted
value can be found.
Content-SHA1-Tree contains the hashes needed to verify a fragment. In
the above example, the header of the first fragment is:
Content-SHA1-Tree: id-hash hash4 hash5678
The first hash in the list is always the identifying hash, but notice
that there is nothing to identify hash4 as hash4. This must be
deduced from the total size of the file and which blocks are included
in the fragment. Given that information, the above tree can be
constructed, and it is easy to spot which hashes are needed. The
order of the hashes is from the root and up, left to right, depth
first.
The total size of the file and the offset of the fragment into the
complete file is information which must be available from other
headers, e.g., Content-Disposition.
For completeness, here are the headers for fragment 2 and 3:
Content-SHA1-Tree: id-hash hash12 hash3 hash78
Content-SHA1-Tree: id-hash hash1234 hash56
Each hash is a 160-bit number presented in BASE64. It will generally
require 27 characters to encode, but with many leading zero bits, it
can be less. When used with large files, the number of hashes can
become quite large. It is suggested that the header is folded on
whitespace to keep line length down.
The size of a block must be constant across implementations. The
chosen value is 22500 octets. The last block may be less than that,
but there is no need to zero-pad the data (it will actually give the
wrong result if you do), SHA1 accepts blocks of data of arbitrary
size.
----- ends -----
did I miss anything an implementer needs to know? can the
presentation be improved (of course it can! please help! :-)
--
Kjetil T. | read and make up your own mind
| http://www.cactus48.com/truth.html
Receiving email into a program -- also CMC
Author: Jon S. Kyle
Date: Mon, 13 Jan 2003 20:11
Date: Mon, 13 Jan 2003 20:11
33 lines
2442 bytes
2442 bytes
Can someone help me? I'm new at this SMTP stuff.
I've got some C++ apps (on Win2K Server) that need to send and receive
email.
Sending is no problem -- just write message file into
"Inetpub\mailroot\Pickup" and bingo!
But... how do I receive messages (by getting out of "Inetpub\mailroot\Drop"
or otherwise)?
Here's my status:
I've searched the MS documentation and concluded that I need to use CMC.
I've compiled the "Using Common Extensions: CMC Sample" program. Compile is
clean, but every external reference is unresolved:
error LNK2001: unresolved external symbol _cmc_logoff@16
error LNK2001: unresolved external symbol _cmc_free@4
error LNK2001: unresolved external symbol _cmc_logon@36
error LNK2001: unresolved external symbol _cmc_query_configuration@16
Specifying "mapi32.lib" doesn't help, and nothing in MS documentation says
what lib to use.
Am I off track? Can someone suggest what to do? Is CMC the right approach
to get email directly into my C++ program?
Thanks.
Re: Receiving email into a program -- also CMC
Author: Jeffrey M. Vinocur
Date: Mon, 13 Jan 2003 22:11
Date: Mon, 13 Jan 2003 22:11
18 lines
1538 bytes
1538 bytes
In article <PRednX63gNzpgL6jXTWcqA@comcast.com>, Jon S. Kyle <_NOSPAM_JKyle@SpeedwaySoftware.com> wrote: >Can someone help me? I'm new at this SMTP stuff. > >I've got some C++ apps (on Win2K Server) that need to send and receive >email. Boy are you in the wrong newsgroup. This group is for the NNTP protocol. I don't know if you need an SMTP group or a Windows programming group, but try http://groups.google.com/ for a good way to find the appropriate place. -- Jeffrey M. Vinocur jeff@litech.org
Re: Receiving email into a program -- also CMC
Author: sungam
Date: Tue, 14 Jan 2003 13:52
Date: Tue, 14 Jan 2003 13:52
21 lines
1730 bytes
1730 bytes
You can take a look at GlobeSofts GSMail Manager and try it out for free to see if it fits your needs http://www.globesoft.com jeff@litech.org (Jeffrey M. Vinocur) wrote in message news:<avvdhu$156$1@puck.litech.org>... > In article <PRednX63gNzpgL6jXTWcqA@comcast.com>, > Jon S. Kyle <_NOSPAM_JKyle@SpeedwaySoftware.com> wrote: > >Can someone help me? I'm new at this SMTP stuff. > > > >I've got some C++ apps (on Win2K Server) that need to send and receive > >email. > > Boy are you in the wrong newsgroup. This group is for the NNTP > protocol. > > I don't know if you need an SMTP group or a Windows programming > group, but try http://groups.google.com/ for a good way to find > the appropriate place.
Re: Content-SHA1-Tree
Author: Curt Welch
Date: Sat, 18 Jan 2003 19:33
Date: Sat, 18 Jan 2003 19:33
275 lines
14209 bytes
14209 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> I thought I'd try my hand at writing a specification of
> Content-SHA1-Tree, but before foisting it on the MIME people, I guess
> it's best that people here (at least Curt) has a look at it and sees
> that it is right.
The first issue is the name. I'm not sure what it should be. SHA1-Tree
implies to me that it's either just the hash value of the content, or it's
the entire tree of hash values. But the xBin-Siganture header is not a
hash value of the content of the article, it's hash values of all the data
from the full file which is not included in this article.
MIME supports some digital signature standards doesn't it? What type of
MIME headers are used to hold signature data? Is it a Content-? header?
I'm thinking you need something like Content-Xbin-Signature: instead of
trying to think of it as a "generic" hash system which is what happens when
you use "SHA1-Tree".
"Content-full-file-SHA1-22500-Tree:" would be type type of header which
would hold the full-file hash for the data which this segement came from.
> ----- begins -----
> Content-SHA1-Tree is a header which is used to verify the correct
> transfer of a file. It differs from most other hashes in that it can
> verify individual fragments of a file, with only the information
> included in this header and the fragment itself.
>
> The basic principle is to create an identifying hash which builds on a
> tree of hashes. The file is split into blocks and the data in each
> block is hashed, using SHA1 as the hashing algorithm.
>
> +--------+--------+--------+--------+-- - - --+--------+
> | block1 | block2 | block3 | block4 | | block8 |
> +--------+--------+--------+--------+-- - - --+--------+
> | | | | |
> v v v v v
> hash1 hash2 hash3 hash4 ... hash8
>
> Each hashN is a 160 bits value. Concatenate hash1 and hash2, and run
> SHA1 on those 320 bits. Let's call the resulting hash value hash12.
> Do the same for hash3 and hash4, etc. Now move up a level, and run
> SHA1 on the concatenation of hash12 and hash34, etc. Finally,
> concatenate hash1234 and hash5678, run SHA1 on it. The result is the
> hash used to identify the file.
>
> hash1 hash2 hash3 hash4 hash5 hash6 hash7 hash8
> | | | | | | | |
> +---+---+ +---+---+ +---+---+ +---+---+
> | | | |
> hash12 hash34 hash56 hash78
> | | | |
> +-------+-------+ +-------+-------+
> | |
> hash1234 hash5678
> | |
> +---------------+---------------+
> |
> identifying hash
>
> If we have all the data and the identifying hash, it is easy to verify
> that the hash matches. If we only have some of the data (and the
> identifying hash),
I put the full-file hash in the Signature: header not because it was needed
there, but because the full hash was not included in the Message-ID. If we
were to put the full hash in the Message-ID, then you wouldn't want the
full hash to be included in the Signature data.
In the MIME way of things, if you needed the full hash in the headers I
would expect it to show up either in a different header,
(Content-Full-File-XBin-Hash:) or show up at a named paramater in some
other header?
Full-File-Details: size=NNN; hash=XXX
???
> we need either more data, or more hashes. Let's
> say the file in question was split in three, with the first fragment
> containing three blocks. It is easy to calculate hash1, hash2, hash3
> and hash12 from the data, but then we're stuck. To continue the
> calculation, we need hash4. Now we can calculate hash34 and hash1234.
> If we're supplied with hash5678 as well, the identifying hash can be
> verified. Hence, the first fragment only needs the hashes hash4 and
> hash5678 to verify that the first three blocks are a genuine part of
> the complete file.
>
> To complete the example: Fragment 2, containing blocks 4, 5 and 6,
> needs hashes hash12, hash3 and hash78. The last fragment needs hashes
> hash1234 and hash56.
>
> In order to fool this algorithm into verifying false data, you would
> have to find a (false) value for hash5678, which, when hashed with the
> hash1234 calculated from the false data, gives the identifying hash as
> its answer. SHA1 is considered a cryptographically secure hash, that
> is, there is no known way to create data which produces a given hash.
> With current technology, this requires a brute force attack in a 160
> bits namespace, and there isn't even any guarantee that the wanted
> value can be found.
>
> Content-SHA1-Tree contains the hashes needed to verify a fragment. In
> the above example, the header of the first fragment is:
>
> Content-SHA1-Tree: id-hash hash4 hash5678
Is the format of having data separated by spaces consistent with the way
MIME likes to do things?
> The first hash in the list is always the identifying hash, but notice
> that there is nothing to identify hash4 as hash4. This must be
> deduced from the total size of the file and which blocks are included
> in the fragment.
Which points out that to understand this header, you must have that other
data. I think that pretty much means you need to define how that would be
done in Mime Headers as well and you won't be able to get this header
defined as a standard without also defining those headers.
In xBin, we are talking about craming all that data in the Message-ID. No
one would every do that for a "real" standard designed from the ground up
to put this data in the headers. We are talking about doing this only
because of the evolutionary needs of Usenet. Putting it in the Message-Id
will make the system work very well for all existing news servers.
I doubt that defining a Message-ID format to include this data could every
become a MIME standard. It's just too "wrong". But it would fit in MIME
as other types of headers.
MIME has no support for the notion of a "file segment". It could be added,
but it's going to get very complex and effect the "meaning" of many of the
current MIME headers.
What is the correct content-type for a segment of a jpg file? Is it
image/jpg or is it something like:
Content-Type: application/octet-stream; file-content=image/jpg;
Or, if you were going to redfeine MIME from the ground up to support this
correctly, should be:
Content-Type: file-segment/image/jpg
Or should it be:
Content-Type: file/segment
File-Content-Type: image/jpg
These are all complex issues that have to be figured out to correctly
support xBin-like file segments in MIME and until you think about and find
the best answers to all these issues, knowing the correct answer to how to
create a Content-Xbin-Signature: header is going to be very hard.
> Given that information, the above tree can be
> constructed, and it is easy to spot which hashes are needed. The
> order of the hashes is from the root and up, left to right, depth
> first.
I would leave the "up" vs "down" vs "right" vs "left" issues out of that
and just say: "depth first low to high".
You could also simply say, "low to high".
> The total size of the file and the offset of the fragment into the
> complete file is information which must be available from other
> headers, e.g., Content-Disposition.
>
> For completeness, here are the headers for fragment 2 and 3:
>
> Content-SHA1-Tree: id-hash hash12 hash3 hash78
> Content-SHA1-Tree: id-hash hash1234 hash56
Ah, I see, I first though you got that wrong because when you said
"fragment 2" I was thinking block 2. It could be clearer:
For completeness, here is the header for fragment 2 which containes
blocks 4, 5 and 6:
Content-SHA1-Tree: id-hash hash12 hash3 hash78
And fragment 3, which containes blocks 7 and 8:
Content-SHA1-Tree: id-hash hash1234 hash56
> Each hash is a 160-bit number presented in BASE64. It will generally
> require 27 characters to encode, but with many leading zero bits, it
> can be less.
I encoded it not as a 160 bit number but as 20 bytes in straight MIME
BASE64, which means you chop it into 6 bit chunks left to right instead of
right to left and you do not remove leading zeros.
The numbers (but not the hash) in the Message-ID I encoded as base64
numbers. (i.e. right to left with leading zeros removed).
> When used with large files, the number of hashes can
> become quite large. It is suggested that the header is folded on
> whitespace to keep line length down.
What does MIME say about header lengths? Anything?
> The size of a block must be constant across implementations. The
> chosen value is 22500 octets.
I'e had second thoughts about that which I hope to post here at some
points.
For now, my argument of being uuencode compatible and the lack of any real
need to be power of two based is valid. But down the road, I see servers
optimized to store these blocks, and at that point, power-of-two sized
junks would be justified. So maybe it does make sense to try and make it a
power-of-two based hash block size now. The question then becomes, how
much problem will this cause for uuencode posts????
> The last block may be less than that,
> but there is no need to zero-pad the data (it will actually give the
> wrong result if you do), SHA1 accepts blocks of data of arbitrary
> size.
>
> ----- ends -----
>
> did I miss anything an implementer needs to know? can the
> presentation be improved (of course it can! please help! :-)
Your post is good. But the complex problem is that you are starting to
define how it will all fit into MIME. I don't think you can get away with
defining only this one header now. If you could, then we could use that as
the standard X-Bin header even for non-MIME posts. And that seems like it
would be wise. So looking into this future seems worth the time.
But MIME just doesn't currently support the concept of a file-segment. You
can transport them in MIME of course as generic application/octect-stream
data chunks, but then that approach would encourage you to put the file
informaion and the signature information into the data instead of in the
MIME headers. i.e., either "what you are trasporting" is hidden to the
MIME application (the application/octet-stream" approach, or the "what you
are transporting" is "known" to the mime application, in which case the
signature and other full-file information needs to be in the MIME headers.
xBin is very much the idea that the newsreader application "knows" what it
is transporting instead of using an external application (like winrar/par)
to deal with the data after it's extracted by the newsreader. So, all this
stuff belongs in the headers. So, for it do be done correctly in MIME, it
needs to be defined at the MIME header level, like you are tying to do
here. But to be compatible with all other MIME aware clients which have
allready been writen without any support for the idea of a "file segment",
it's going to be a bit complex to figure out the best way to shoe-horn this
very basic concept into a standard (and all the existing applications)
which were never meant to support it.
I'm sure this can be done, and it's probably not even that hard, but I do
suspect it's a lot of work and I suspect that trying to define one header
like Content-SHA1-Tree without addressing the entire problem would be the
wrong approach.
My thought is that it would be better to leave MIME out of the problem
intentionally for now, and create something that's custom designed to solve
the problems of Usenet. Then, later, if the standard catches on for
Usenet, the MIME guys might be motivated to attack the general problem of
the correct way to support "file-segments" in MIME messages. Once that was
done, and if it was done correctly so it could support xBin messages, then
Usenet could evolve to correctly labeling all the xBin articles with the
correct MIME headers as well.
It would be good if we could take a stab like you have done to see what the
header "should" look like to fit in MIME. If a later version of MIME could
use the same header, it would of course make the conversion to MIME easier
later. But it just always seems that the standards that come later are
always forced to change something anyhow and that the odds of picking
something know that will work later with MIME are very small....
--
Curt Welch http://CurtWelch.Com/
curt@kcwc.com Webmaster for http://NewsReader.Com/
Re: Content-SHA1-Tree
Author: Kjetil Torgrim Homme
Date: Sun, 19 Jan 2003 00:38
Date: Sun, 19 Jan 2003 00:38
291 lines
14213 bytes
14213 bytes
[Curt Welch]:
>
> Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> > I thought I'd try my hand at writing a specification of
> > Content-SHA1-Tree, but before foisting it on the MIME people, I guess
> > it's best that people here (at least Curt) has a look at it and sees
> > that it is right.
>
> The first issue is the name. I'm not sure what it should
> be. SHA1-Tree implies to me that it's either just the hash value
> of the content, or it's the entire tree of hash values. But the
> xBin-Siganture header is not a hash value of the content of the
> article, it's hash values of all the data from the full file which
> is not included in this article.
>
> MIME supports some digital signature standards doesn't it? What
> type of MIME headers are used to hold signature data? Is it a
> Content-? header?
they use a multipart with two content-types, application/pkcs7-mime
and application/pkcs7-signature.
> I'm thinking you need something like Content-Xbin-Signature:
> instead of trying to think of it as a "generic" hash system which
> is what happens when you use "SHA1-Tree".
perhaps, but SHA1-Tree is more descriptive (and not strictly wrong)
than Xbin-Signature. SHA1-Tree sounds more sexy, Xbin-Signature
sounds like something cooked up in a bedroom. perhaps
"SHA1-Signature"? or "Tree-Signature"? not a big issue for me,
though.
> I put the full-file hash in the Signature: header not because it
> was needed there, but because the full hash was not included in
> the Message-ID. If we were to put the full hash in the
> Message-ID, then you wouldn't want the full hash to be included in
> the Signature data.
right, but that's not an option, since you can have multiple parts
(files) in a MIME message. each part could have its own signature.
> In the MIME way of things, if you needed the full hash in the
> headers I would expect it to show up either in a different header,
> (Content-Full-File-XBin-Hash:) or show up at a named paramater in
> some other header?
why? I think it fits naturally as the first hash in the signature
data. another header makes the parser more complex.
> Full-File-Details: size=NNN; hash=XXX
>
> ???
the header name must begin with "Content-". MIME is both very strict
and very lenient about this, since it will accept any unknown
Content-Header, but disallow any NonContent-Header.
> > Content-SHA1-Tree contains the hashes needed to verify a fragment. In
> > the above example, the header of the first fragment is:
> >
> > Content-SHA1-Tree: id-hash hash4 hash5678
>
> Is the format of having data separated by spaces consistent with
> the way MIME likes to do things?
yeah, I think so.
> > The first hash in the list is always the identifying hash, but
> > notice that there is nothing to identify hash4 as hash4. This
> > must be deduced from the total size of the file and which blocks
> > are included in the fragment.
>
> Which points out that to understand this header, you must have
> that other data. I think that pretty much means you need to
> define how that would be done in Mime Headers as well and you
> won't be able to get this header defined as a standard without
> also defining those headers.
that's why I'm pushing for extending Content-Disposition with this
data in comp.mail.mime. so far, I've had little success, people want
to do Content-Type: application/fragment, which I think is a horrible
layering violation (this was Jeremy's suggestion as well, a year ago).
it's interesting to note that there is no requirement to have an
approved RFC to register a new parameter for Content-Disposition, it
suffices to present a description for its semantics to IANA. it's
more important to convince Chris Morse than the MIME crowd, if you
know what I'm saying.
> I doubt that defining a Message-ID format to include this data
> could every become a MIME standard. It's just too "wrong".
definitely.
> What is the correct content-type for a segment of a jpg file?
there is no mechanism for it.
> > Given that information, the above tree can be constructed, and
> > it is easy to spot which hashes are needed. The order of the
> > hashes is from the root and up, left to right, depth first.
>
> I would leave the "up" vs "down" vs "right" vs "left" issues out
> of that and just say: "depth first low to high".
>
> You could also simply say, "low to high".
noted.
> > For completeness, here are the headers for fragment 2 and 3:
> >
> > Content-SHA1-Tree: id-hash hash12 hash3 hash78
> > Content-SHA1-Tree: id-hash hash1234 hash56
>
> Ah, I see, I first though you got that wrong because when you said
> "fragment 2" I was thinking block 2. It could be clearer:
noted.
> > Each hash is a 160-bit number presented in BASE64. It will
> > generally require 27 characters to encode, but with many leading
> > zero bits, it can be less.
>
> I encoded it not as a 160 bit number but as 20 bytes in straight
> MIME BASE64, which means you chop it into 6 bit chunks left to
> right instead of right to left and you do not remove leading
> zeros.
do you think that is superior?
> The numbers (but not the hash) in the Message-ID I encoded as base64
> numbers. (i.e. right to left with leading zeros removed).
that's why I chose to represent the hash the same way, the code must
have a function to transform a number into BASE64, anyway. the
question is: is it better to require the implementation to have _one_
generalised function than to require it to have _two_ functions which
are slightly easier to implement?
oh! we need to specify whether the numbers are encoded as little- or
big-endian. little-endian is a tiny bit easier to code, just do:
while number > 0
output number AND 111111b
number SHIFT RIGHT 6
big-endian needs buffering to reverse the order of the octets.
intuitively, as a Westerner, I'd expect the numbers to be big-endian.
> > When used with large files, the number of hashes can become
> > quite large. It is suggested that the header is folded on
> > whitespace to keep line length down.
>
> What does MIME say about header lengths? Anything?
RFC 2047 says:
While there is no limit to the length of a multiple-line header
field, each line of a header field that contains one or more
'encoded-word's is limited to 76 characters.
we don't use encoded-words, so we're actually free to do what we like
within the bounds of the transmitting protocol (SMTP or NNTP).
> > The size of a block must be constant across implementations. The
> > chosen value is 22500 octets.
>
> I'e had second thoughts about that which I hope to post here at
> some points.
well, it is easy to change this number during discussion.
> For now, my argument of being uuencode compatible and the lack of
> any real need to be power of two based is valid. But down the
> road, I see servers optimized to store these blocks, and at that
> point, power-of-two sized junks would be justified. So maybe it
> does make sense to try and make it a power-of-two based hash block
> size now. The question then becomes, how much problem will this
> cause for uuencode posts????
you've still convinced me that the overhead for the non-power-of-two
is down in the noise. 500 line blocks is also friendly to uuencode
users. MIME users don't do multipart posts, so they probably don't
have any feel for how many lines a post should be chopped into. (76
BASE64 digits gives a block size of 394.7 lines :-)
> > did I miss anything an implementer needs to know? can the
> > presentation be improved (of course it can! please help! :-)
>
> Your post is good. But the complex problem is that you are
> starting to define how it will all fit into MIME. I don't think
> you can get away with defining only this one header now.
right, there are three pieces to the puzzle:
the signature
the fragment information
the Message-ID convention
MIME will not care about that last one. it's just an optimisation
hack for news.
> If you could, then we could use that as the standard X-Bin header
> even for non-MIME posts. And that seems like it would be wise. So
> looking into this future seems worth the time.
uuencoded posts can use the MIME headers, but shouldn't include
"MIME-Version: 1.0" unless the document is well-formed. (it can be,
but it is not common to do that -- why bother when BASE64 is more
efficient anyway?)
> But MIME just doesn't currently support the concept of a
> file-segment. You can transport them in MIME of course as generic
> application/octect-stream data chunks, but then that approach
> would encourage you to put the file informaion and the signature
> information into the data instead of in the MIME headers. i.e.,
> either "what you are trasporting" is hidden to the MIME
> application (the application/octet-stream" approach, or the "what
> you are transporting" is "known" to the mime application, in which
> case the signature and other full-file information needs to be in
> the MIME headers.
yeah. I detest that approach.
> So, for it do be done correctly in MIME, it needs to be defined at
> the MIME header level, like you are tying to do here. But to be
> compatible with all other MIME aware clients which have allready
> been writen without any support for the idea of a "file segment",
> it's going to be a bit complex to figure out the best way to
> shoe-horn this very basic concept into a standard (and all the
> existing applications) which were never meant to support it.
any new feature needs new code to support it. by adding the fragment
information to Content-Disposition, old clients will simply store or
present the fragment as if it was the complete file. the user can
piece them together himself if he elects to save to disk. the icky
point is preview, since the fragment will lack the headers of the
complete file. a quality implementation will of course handle bogus
data without incident and tell the user that the decode failed. a bad
implementation may crash, it's even conceivable you can smash its
stack. but a malcious user could have sent that fragment as if it was
a complete file anyway, so it doesn't impact the security
considerations.
> I'm sure this can be done, and it's probably not even that hard,
> but I do suspect it's a lot of work and I suspect that trying to
> define one header like Content-SHA1-Tree without addressing the
> entire problem would be the wrong approach.
I try to address the entire problem, but I also try to keep separate
issues separate. fragmentation is useful even without a signature to
verify its integrity. similarily, Content-SHA1-Tree can be used on a
file posted in a single article (it will contain only the root hash),
although in that case most people would choose to use the existing
Content-MD5 instead. but the mechanisms are orthogonal.
> My thought is that it would be better to leave MIME out of the
> problem intentionally for now, and create something that's custom
> designed to solve the problems of Usenet.
let me here what you think needs be different.
> Then, later, if the standard catches on for Usenet, the MIME guys
> might be motivated to attack the general problem of the correct
> way to support "file-segments" in MIME messages. Once that was
> done, and if it was done correctly so it could support xBin
> messages, then Usenet could evolve to correctly labeling all the
> xBin articles with the correct MIME headers as well.
yEnc and uuencode makes such a mess of even basic things like
filenames -- it would be benificial to allow Content-Type and
Content-Disposition to override their cruft. but a
Content-Disposition containing only "offset=NNNN; total-size=NNNN"
would be sufficient of course.
> It would be good if we could take a stab like you have done to see
> what the header "should" look like to fit in MIME. If a later
> version of MIME could use the same header, it would of course make
> the conversion to MIME easier later. But it just always seems
> that the standards that come later are always forced to change
> something anyhow and that the odds of picking something know that
> will work later with MIME are very small....
we can do this in MIME today[1]. neither Content-X nor parameters for
Content-Disposition require concensus in the working groups.
[1] well, in a week's time, it will probably take some time to
percolate to the top of IANA's stack of pending registrations.
--
Kjetil T. | read and make up your own mind
| http://www.cactus48.com/truth.html
Re: Content-SHA1-Tree
Author: those who know me have no need o...
Date: Sun, 19 Jan 2003 06:17
Date: Sun, 19 Jan 2003 06:17
13 lines
1356 bytes
1356 bytes
in news.software.nntp i read: >The first issue is the name. I'm not sure what it should be. >I'm thinking you need something like Content-Xbin-Signature: instead of >trying to think of it as a "generic" hash system which is what happens when >you use "SHA1-Tree". i'm thinking it needs a leading x-, at least at this point in time. -- bringing you boring signatures for 17 years
Re: Content-SHA1-Tree
Author: Curt Welch
Date: Sun, 19 Jan 2003 07:35
Date: Sun, 19 Jan 2003 07:35
388 lines
19379 bytes
19379 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> [Curt Welch]:
> >
> > Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> > > I thought I'd try my hand at writing a specification of
> > > Content-SHA1-Tree, but before foisting it on the MIME people, I
> > > guess it's best that people here (at least Curt) has a look at it
> > > and sees that it is right.
> >
> > The first issue is the name. I'm not sure what it should
> > be. SHA1-Tree implies to me that it's either just the hash value
> > of the content, or it's the entire tree of hash values. But the
> > xBin-Siganture header is not a hash value of the content of the
> > article, it's hash values of all the data from the full file which
> > is not included in this article.
> >
> > MIME supports some digital signature standards doesn't it? What
> > type of MIME headers are used to hold signature data? Is it a
> > Content-? header?
>
> they use a multipart with two content-types, application/pkcs7-mime
> and application/pkcs7-signature.
>
> > I'm thinking you need something like Content-Xbin-Signature:
> > instead of trying to think of it as a "generic" hash system which
> > is what happens when you use "SHA1-Tree".
>
> perhaps, but SHA1-Tree is more descriptive (and not strictly wrong)
> than Xbin-Signature. SHA1-Tree sounds more sexy, Xbin-Signature
> sounds like something cooked up in a bedroom. perhaps
> "SHA1-Signature"? or "Tree-Signature"? not a big issue for me,
> though.
The important fact is that it's data which includes not only the idea of a
tree hash build on SHA1, but it also includes a defined block size (unless
you want to include the block size in the header data somewhere), and, it's
not just a hash value for the full file, but it's the hash of the missing
data, which makes it even more unlike anything else. Nothing comes to mind
as a "correct" name for this data. "signature" is the closesest I've been
able to come up with but even that doesn't really fit with the more tyical
use of the word for these things. Well, maybe something like "checksum" or
"CRC" really fits the concept beter because it's information used to verify
the integrety of the data.
Is there a generic name/word for checksum or CRC?
It seems the header should be something like
Content-<standard>-<generic-word-for-checksum>:
Where <standard> is some name which refers to the standard used (xBin has
been the working title here). SHA1-22500-TreeHash would be stupid
alternative but that's the idea I'm after.
> > In the MIME way of things, if you needed the full hash in the
> > headers I would expect it to show up either in a different header,
> > (Content-Full-File-XBin-Hash:) or show up at a named paramater in
> > some other header?
>
> why? I think it fits naturally as the first hash in the signature
> data. another header makes the parser more complex.
Ok, I take that back. To veryify the data you need the full hash. The
rest of the header is useless if you don't have the full-hash somewhere to
compare the result to so it does actaully fit nicely there.
> > Full-File-Details: size=NNN; hash=XXX
> >
> > ???
>
> the header name must begin with "Content-". MIME is both very strict
> and very lenient about this, since it will accept any unknown
> Content-Header, but disallow any NonContent-Header.
Ok.
> > > The first hash in the list is always the identifying hash, but
> > > notice that there is nothing to identify hash4 as hash4. This
> > > must be deduced from the total size of the file and which blocks
> > > are included in the fragment.
> >
> > Which points out that to understand this header, you must have
> > that other data. I think that pretty much means you need to
> > define how that would be done in Mime Headers as well and you
> > won't be able to get this header defined as a standard without
> > also defining those headers.
>
> that's why I'm pushing for extending Content-Disposition with this
> data in comp.mail.mime.
I don't do mime. But, I was just looking at the "content-disposition" RFC
and it looks like the entire point of the header is to specify display
symantics. (i.e. data should be displaied in-line vs as an attachement).
Puting important content information that just seems completley wrong.
> so far, I've had little success, people want
> to do Content-Type: application/fragment,
It seems to me that putting it there assume that the mime tool isn't going
to deal with the fragment. It's just going to pass the data to some
external application which knows how to deal with "fragments". If that in
fact is how it would be done, then the important meta data like the
Signature and the full file size and the segment offset and size would be
embeded in the data and not in the mime headers.
> which I think is a horrible
> layering violation (this was Jeremy's suggestion as well, a year ago).
> it's interesting to note that there is no requirement to have an
> approved RFC to register a new parameter for Content-Disposition, it
> suffices to present a description for its semantics to IANA. it's
> more important to convince Chris Morse than the MIME crowd, if you
> know what I'm saying.
I don't know who Chris Morse is so no I don't know what you mean. But
that's not really important anyhow.
This touches on the issues of "doing it right", vs "squezing it into a
cornor somewhwhere just to make it work". Content-Disposition might just
happen to be a free corner you can stick crap in easily instead of doing it
right.
It gets to the point of trying to decide if "doing it right" is really
important enough to justify. We can make usenet work fine without MIME.
So the issue is, is this important enough for e-mail and MIME to get it
done "right"?
> > What is the correct content-type for a segment of a jpg file?
>
> there is no mechanism for it.
Yeah, I know.
I was really trying to ask "what should be the correct content-type of a
segment of a jpg file"?
> > > Each hash is a 160-bit number presented in BASE64. It will
> > > generally require 27 characters to encode, but with many leading
> > > zero bits, it can be less.
> >
> > I encoded it not as a 160 bit number but as 20 bytes in straight
> > MIME BASE64, which means you chop it into 6 bit chunks left to
> > right instead of right to left and you do not remove leading
> > zeros.
>
Encoding it as number is natural if the data fits in an "int" which the 160
bit hash doesn't. If it doesn't fit in an int, then encoding it as an
array of bytes using the standard MIME base64 algorithm for encoding byte
data seems more natural to me.
> > The numbers (but not the hash) in the Message-ID I encoded as base64
> > numbers. (i.e. right to left with leading zeros removed).
>
> that's why I chose to represent the hash the same way, the code must
> have a function to transform a number into BASE64, anyway. the
> question is: is it better to require the implementation to have _one_
> generalised function than to require it to have _two_ functions which
> are slightly easier to implement?
>
> oh! we need to specify whether the numbers are encoded as little- or
> big-endian. little-endian is a tiny bit easier to code, just do:
>
> while number > 0
> output number AND 111111b
> number SHIFT RIGHT 6
>
> big-endian needs buffering to reverse the order of the octets.
> intuitively, as a Westerner, I'd expect the numbers to be big-endian.
For the numeric values, I used big-endian and did buffer it.
I don't know how SHA1 is defined in the standards, but in the code I used,
it was defined as an array of bytes (unsigned char digest[20]), not as a
160 bit number. So you first have to define big vs little endian
conversion to define how the 160 bit number is constructed from those 20
bytes, then, when converting to BASE64, you have to define how base64
numbers are output. If you think about it as a number, then you want to
follow the normal convention and and output the high-order base64 "digits"
first (on the left).
But, since it's already an array of bytes and not a number, I think it's
more obvious (particually in MIME) to output it just like you would output
a 20 byte file which was BASE64 encoded.
For the xBin message-id stuff, I think treating the hash the same way there
makes sense, and treating the numeric values differently (as base64 numbers
where leading "zeros" (which is actually A in the MIME base64 alphabet) are
truncated is justifyed.
> > > When used with large files, the number of hashes can become
> > > quite large. It is suggested that the header is folded on
> > > whitespace to keep line length down.
> >
> > What does MIME say about header lengths? Anything?
>
> RFC 2047 says:
>
> While there is no limit to the length of a multiple-line header
> field, each line of a header field that contains one or more
> 'encoded-word's is limited to 76 characters.
>
> we don't use encoded-words, so we're actually free to do what we like
> within the bounds of the transmitting protocol (SMTP or NNTP).
Cool, then that's not an issue.
> > > The size of a block must be constant across implementations. The
> > > chosen value is 22500 octets.
> >
> > I'e had second thoughts about that which I hope to post here at
> > some points.
>
> well, it is easy to change this number during discussion.
>
> > For now, my argument of being uuencode compatible and the lack of
> > any real need to be power of two based is valid. But down the
> > road, I see servers optimized to store these blocks, and at that
> > point, power-of-two sized junks would be justified. So maybe it
> > does make sense to try and make it a power-of-two based hash block
> > size now. The question then becomes, how much problem will this
> > cause for uuencode posts????
>
> you've still convinced me that the overhead for the non-power-of-two
> is down in the noise. 500 line blocks is also friendly to uuencode
> users. MIME users don't do multipart posts, so they probably don't
> have any feel for how many lines a post should be chopped into. (76
> BASE64 digits gives a block size of 394.7 lines :-)
Yeah, it's not the computation overhead, it's that a news/file server which
is designed from the ground up to store xBin data would use the xBin hash
block size it's basic unit of storage. It would have an interface which
would allow you to store and fetch individual blocks from any xbin-id file.
(STORE <file-id> <blocknumber>, and GET <file-id> <blocknumber>). It would
be a serious efficency issue if you have to store 22500 byte blocks in this
file system instead of power-of-two blocks. To make that work nicely in
the future, I'm thinking something like 32K blocks would be better. But is
making things worse for uuencode now going to prevent us from every getting
to the point where we would want to build this xBin file system in the
future? Maybe.
> > > did I miss anything an implementer needs to know? can the
> > > presentation be improved (of course it can! please help! :-)
> >
> > Your post is good. But the complex problem is that you are
> > starting to define how it will all fit into MIME. I don't think
> > you can get away with defining only this one header now.
>
> right, there are three pieces to the puzzle:
>
> the signature
> the fragment information
> the Message-ID convention
>
> MIME will not care about that last one. it's just an optimisation
> hack for news.
Right.
> > If you could, then we could use that as the standard X-Bin header
> > even for non-MIME posts. And that seems like it would be wise. So
> > looking into this future seems worth the time.
>
> uuencoded posts can use the MIME headers, but shouldn't include
> "MIME-Version: 1.0" unless the document is well-formed. (it can be,
> but it is not common to do that -- why bother when BASE64 is more
> efficient anyway?)
>
> > But MIME just doesn't currently support the concept of a
> > file-segment. You can transport them in MIME of course as generic
> > application/octect-stream data chunks, but then that approach
> > would encourage you to put the file informaion and the signature
> > information into the data instead of in the MIME headers. i.e.,
> > either "what you are trasporting" is hidden to the MIME
> > application (the application/octet-stream" approach, or the "what
> > you are transporting" is "known" to the mime application, in which
> > case the signature and other full-file information needs to be in
> > the MIME headers.
>
> yeah. I detest that approach.
>
> > So, for it do be done correctly in MIME, it needs to be defined at
> > the MIME header level, like you are tying to do here. But to be
> > compatible with all other MIME aware clients which have allready
> > been writen without any support for the idea of a "file segment",
> > it's going to be a bit complex to figure out the best way to
> > shoe-horn this very basic concept into a standard (and all the
> > existing applications) which were never meant to support it.
>
> any new feature needs new code to support it. by adding the fragment
> information to Content-Disposition, old clients will simply store or
> present the fragment as if it was the complete file. the user can
> piece them together himself if he elects to save to disk. the icky
> point is preview, since the fragment will lack the headers of the
> complete file. a quality implementation will of course handle bogus
> data without incident and tell the user that the decode failed. a bad
> implementation may crash, it's even conceivable you can smash its
> stack. but a malcious user could have sent that fragment as if it was
> a complete file anyway, so it doesn't impact the security
> considerations.
>
> > I'm sure this can be done, and it's probably not even that hard,
> > but I do suspect it's a lot of work and I suspect that trying to
> > define one header like Content-SHA1-Tree without addressing the
> > entire problem would be the wrong approach.
>
> I try to address the entire problem, but I also try to keep separate
> issues separate. fragmentation is useful even without a signature to
> verify its integrity.
Right, the signature/integrity header should be separate like you are
doing. I think that fits nicely into mime. It's just a question of the
name and format and other minor stuff that's not a big issue.
> similarily, Content-SHA1-Tree can be used on a
> file posted in a single article (it will contain only the root hash),
> although in that case most people would choose to use the existing
> Content-MD5 instead. but the mechanisms are orthogonal.
Interesting how that works when you include the full-hash in the header
like that.
> > My thought is that it would be better to leave MIME out of the
> > problem intentionally for now, and create something that's custom
> > designed to solve the problems of Usenet.
>
> let me here what you think needs be different.
I think we are getting closer. The signature header is starting to feel
like it fits in MIME to me now.
> > Then, later, if the standard catches on for Usenet, the MIME guys
> > might be motivated to attack the general problem of the correct
> > way to support "file-segments" in MIME messages. Once that was
> > done, and if it was done correctly so it could support xBin
> > messages, then Usenet could evolve to correctly labeling all the
> > xBin articles with the correct MIME headers as well.
>
> yEnc and uuencode makes such a mess of even basic things like
> filenames -- it would be benificial to allow Content-Type and
> Content-Disposition to override their cruft. but a
> Content-Disposition containing only "offset=NNNN; total-size=NNNN"
> would be sufficient of course.
Ok, but Content-Disposition just seems the wrong place to put this data (it
has nothing to do with display issues) which seems to me belongs more in
something like Content-Type. Has MIME used Content-Disposition for any
thing else like this which really belongs in Conetent-Type?
> > It would be good if we could take a stab like you have done to see
> > what the header "should" look like to fit in MIME. If a later
> > version of MIME could use the same header, it would of course make
> > the conversion to MIME easier later. But it just always seems
> > that the standards that come later are always forced to change
> > something anyhow and that the odds of picking something know that
> > will work later with MIME are very small....
>
> we can do this in MIME today[1]. neither Content-X nor parameters for
> Content-Disposition require concensus in the working groups.
The Content-X is sounding good now. But you haven't sold me on the idea
that using Content-Disposition would be good. It really feels to me like
it needs to be done in the Content-Type: though I don't know if it's
possible at this late point in the development of MIME because what I'm
talking about is something which I think would break most MIME systems if
it's done how I'm thinking. You need a Content-Type: header which says
"this is a segment of a file and the full-file is: xxx" where xxx is the
normal Content-Type: header.
Something like:
Content-Type: fragment/image/jpg; segment-offset=XXXX segment-size=YYY
Maybe the answer is that it's just too late to "do it right" which means we
are forced to go to the application/fragment and do something like:
Content-Type: application/fragment; file-type=image/jpg frag-offset=XX
...
Then there's the complexity of the PAR data and how that will fit into
mime:
Content-Type: application/par-fragment; ...
--
Curt Welch http://CurtWelch.Com/
curt@kcwc.com Webmaster for http://NewsReader.Com/
Re: Content-SHA1-Tree
Author: Kjetil Torgrim Homme
Date: Mon, 20 Jan 2003 10:05
Date: Mon, 20 Jan 2003 10:05
15 lines
1535 bytes
1535 bytes
[those who know me have no need of my name]: > > > I'm thinking you need something like Content-Xbin-Signature: > > instead of trying to think of it as a "generic" hash system > > which is what happens when you use "SHA1-Tree". > > i'm thinking it needs a leading x-, at least at this point in > time. no, it doesn't, that will only serve to break things. -- Kjetil T. | read and make up your own mind | http://www.cactus48.com/truth.html
Re: Content-SHA1-Tree
Author: those who know me have no need o...
Date: Mon, 20 Jan 2003 10:38
Date: Mon, 20 Jan 2003 10:38
21 lines
1731 bytes
1731 bytes
in news.software.nntp i read: >[those who know me have no need of my name]: >> > I'm thinking you need something like Content-Xbin-Signature: >> > instead of trying to think of it as a "generic" hash system >> > which is what happens when you use "SHA1-Tree". >> >> i'm thinking it needs a leading x-, at least at this point in >> time. > >no, it doesn't, that will only serve to break things. how so? that's it's purpose. will you really wait for std acceptance before perpetrating this header upon usenet (and upon the smtp world too)? from this discussion there isn't even a draft ready, much less anything to submit to any wg. -- bringing you boring signatures for 17 years
Re: Content-SHA1-Tree
Author: Kjetil Torgrim Homme
Date: Mon, 20 Jan 2003 15:44
Date: Mon, 20 Jan 2003 15:44
181 lines
9322 bytes
9322 bytes
[Curt Welch]: > > Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote: > > perhaps, but SHA1-Tree is more descriptive (and not strictly > > wrong) than Xbin-Signature. SHA1-Tree sounds more sexy, > > Xbin-Signature sounds like something cooked up in a bedroom. > > perhaps "SHA1-Signature"? or "Tree-Signature"? not a big issue > > for me, though. > > The important fact is that it's data which includes not only the > idea of a tree hash build on SHA1, but it also includes a defined > block size (unless you want to include the block size in the > header data somewhere), and, it's not just a hash value for the > full file, but it's the hash of the missing data, which makes it > even more unlike anything else. you can't put the entire RFC in the name of the header, you know :-) > Nothing comes to mind as a "correct" name for this data. > "signature" is the closesest I've been able to come up with but > even that doesn't really fit with the more tyical use of the word > for these things. Well, maybe something like "checksum" or "CRC" > really fits the concept beter because it's information used to > verify the integrety of the data. Content-Integrator (isn't someone who checks integrity an integrator?) seriously, Content-Fragment-Check might work (but implies it can't be used with a complete file). > > why? I think it fits naturally as the first hash in the > > signature data. another header makes the parser more complex. > > Ok, I take that back. To veryify the data you need the full hash. > The rest of the header is useless if you don't have the full-hash > somewhere to compare the result to so it does actaully fit nicely > there. but Jeremy made me realise that in the absence of a Message-ID convention, the client needs to do XHDR Content-SHA1-Tree to identify the parts, which will give him a lot more data than he really needs if he only wants a few files. a separate header for the root hash might be a good idea for that reason. > I don't do mime. But, I was just looking at the > "content-disposition" RFC and it looks like the entire point of > the header is to specify display symantics. (i.e. data should be > displaied in-line vs as an attachement). > > Putting important content information that just seems completley > wrong. interesting point. > > so far, I've had little success, people want > > to do Content-Type: application/fragment, > > It seems to me that putting it there assume that the mime tool > isn't going to deal with the fragment. It's just going to pass the > data to some external application which knows how to deal with > "fragments". If that in fact is how it would be done, then the > important meta data like the Signature and the full file size and > the segment offset and size would be embeded in the data and not > in the mime headers. > > > which I think is a horrible > > layering violation (this was Jeremy's suggestion as well, a year ago). > > it's interesting to note that there is no requirement to have an > > approved RFC to register a new parameter for Content-Disposition, it > > suffices to present a description for its semantics to IANA. it's > > more important to convince Chris Morse than the MIME crowd, if you > > know what I'm saying. > > I don't know who Chris Morse is so no I don't know what you mean. But > that's not really important anyhow. > > This touches on the issues of "doing it right", vs "squezing it > into a cornor somewhwhere just to make it work". > Content-Disposition might just happen to be a free corner you can > stick crap in easily instead of doing it right. hey! I believe Content-Disposition is "doing it right". well, actually, I would prefer message/fragment, but that requires more work to get accepted in MIME, and it also has less applicability for non-MIME messages. > It gets to the point of trying to decide if "doing it right" is > really important enough to justify. We can make usenet work fine > without MIME. I'm not sure about that. > So the issue is, is this important enough for e-mail and MIME to > get it done "right"? I think so. > Encoding it as number is natural if the data fits in an "int" > which the 160 bit hash doesn't. If it doesn't fit in an int, then > encoding it as an array of bytes using the standard MIME base64 > algorithm for encoding byte data seems more natural to me. how large is your int? we're talking about multi-gigabyte files here. > For the numeric values, I used big-endian and did buffer it. yeah, network order is big-endian. > I don't know how SHA1 is defined in the standards, but in the code > I used, it was defined as an array of bytes (unsigned char > digest[20]), not as a 160 bit number. So you first have to define > big vs little endian conversion to define how the 160 bit number > is constructed from those 20 bytes, then, when converting to > BASE64, you have to define how base64 numbers are output. If you > think about it as a number, then you want to follow the normal > convention and and output the high-order base64 "digits" first (on > the left). > > But, since it's already an array of bytes and not a number, I > think it's more obvious (particually in MIME) to output it just > like you would output a 20 byte file which was BASE64 encoded. good point. > [...] where leading "zeros" (which is actually A in the MIME > base64 alphabet) [...] yeah, isn't that annoying? I wonder what the rationale for that was. > Yeah, it's not the computation overhead, it's that a news/file > server which is designed from the ground up to store xBin data > would use the xBin hash block size it's basic unit of storage. It > would have an interface which would allow you to store and fetch > individual blocks from any xbin-id file. (STORE <file-id> > <blocknumber>, and GET <file-id> <blocknumber>). It would be a > serious efficency issue if you have to store 22500 byte blocks in > this file system instead of power-of-two blocks. To make that > work nicely in the future, I'm thinking something like 32K blocks > would be better. But is making things worse for uuencode now > going to prevent us from every getting to the point where we would > want to build this xBin file system in the future? Maybe. we still don't know of any uudecode implementations which has a problem with short lines ... > I think we are getting closer. The signature header is starting > to feel like it fits in MIME to me now. glad to hear it :) > Ok, but Content-Disposition just seems the wrong place to put this > data (it has nothing to do with display issues) which seems to me > belongs more in something like Content-Type. Has MIME used > Content-Disposition for any thing else like this which really > belongs in Conetent-Type? I don't think fragment information is more inappropriate for Content-Disposition than the filename. > The Content-X is sounding good now. But you haven't sold me on > the idea that using Content-Disposition would be good. It really > feels to me like it needs to be done in the Content-Type: though I > don't know if it's possible at this late point in the development > of MIME because what I'm talking about is something which I think > would break most MIME systems if it's done how I'm thinking. perhaps message/fragment is more viable than I first thought. we'll see. > Something like: > > Content-Type: fragment/image/jpg; segment-offset=XXXX segment-size=YYY that breaks too much with current practice, I think. there's also the problem that keywords aren't passed reliably to the helper application. -- Kjetil T. | read and make up your own mind | http://www.cactus48.com/truth.html
Re: Content-SHA1-Tree
Author: Kjetil Torgrim Homme
Date: Mon, 20 Jan 2003 15:52
Date: Mon, 20 Jan 2003 15:52
30 lines
2096 bytes
2096 bytes
[those who know me have no need of my name]: > > in news.software.nntp i read: > >[those who know me have no need of my name]: > > >> i'm thinking it needs a leading x-, at least at this point in > >> time. > > > >no, it doesn't, that will only serve to break things. > > how so? that's it's purpose. the purpose of the "x-" is to break things? :-) MIME doesn't need X-, all unknown Content- must be ignored. > will you really wait for std acceptance before perpetrating this > header upon usenet (and upon the smtp world too)? of course not, "proposed standard" should (must?) be sufficient. > from this discussion there isn't even a draft ready, much less > anything to submit to any wg. (. and your attitude is a great help .) -- Kjetil T. | read and make up your own mind | http://www.cactus48.com/truth.html
Re: Content-SHA1-Tree
Author: Bas Ruiter
Date: Tue, 21 Jan 2003 19:40
Date: Tue, 21 Jan 2003 19:40
32 lines
2109 bytes
2109 bytes
> > Nothing comes to mind as a "correct" name for this data. > > "signature" is the closesest I've been able to come up with but > > even that doesn't really fit with the more tyical use of the word > > for these things. Well, maybe something like "checksum" or "CRC" > > really fits the concept beter because it's information used to > > verify the integrety of the data. > > Content-Integrator (isn't someone who checks integrity an integrator?) > > seriously, Content-Fragment-Check might work (but implies it can't be > used with a complete file). Authentication ? Validation ? Tree-Validation Leaf-Authentication etc. Bas Ruiter -- [ l o r d s n o w @home.nl http://members.home.nl/ l o r d s n o w ] Only when the population of 50 mysteriously dropped to 7 did the remainder start to suspect Hungry.
Re: Content-SHA1-Tree
Author: Kjetil Torgrim Homme
Date: Wed, 22 Jan 2003 17:45
Date: Wed, 22 Jan 2003 17:45
22 lines
1886 bytes
1886 bytes
[Bas Ruiter]: > > > seriously, Content-Fragment-Check might work (but implies it can't be > > used with a complete file). > > Authentication ? > Validation ? > > Tree-Validation > Leaf-Authentication I like validation, thanks! Content-Validation is too general, Content-Fragment-Validation is a bit long, but I think it is rather precise, especially if we put the roothash in a header of its own. Content-Tree-Validation could work, and so could Content-Leaf-Validation. -- Kjetil T. | read and make up your own mind | http://www.cactus48.com/truth.html
Re: Content-SHA1-Tree
Author: Curt Welch
Date: Sat, 01 Feb 2003 05:56
Date: Sat, 01 Feb 2003 05:56
133 lines
6651 bytes
6651 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> [Curt Welch]:
> Content-Integrator (isn't someone who checks integrity an integrator?)
>
> seriously, Content-Fragment-Check might work (but implies it can't be
> used with a complete file).
I think "Check" is the best idea I've seen so far. But you need to name of
the standard that defines the check in there as well (like Content-MD5 is
not Content-Hash).
So whether you use xBin or come up with a new names for the hash standard
part of the overall xBin concept I think it needs to be in the header:
Content-XYZ-Check:
Or maybe if the standard was only for this header (and of course the whole
segment-hash-tree concept), then the header will just become:
Content-XYZ:
Where "XYZ" was the name of the hash-tree standard which defined both the
details of the hash tree algorithm and the format for the header.
Sha1 Tree Hash?
Content-STH: xxxxx
But wait....
The hash data in this header by itself is useless (with the exception of
the first hash - the full file hash) if you don't also have the other meta
data which we have talked about putting in the Message-ID - the full file
size, and the offset and size of the included data segment. Maybe we
should look at the idea of putting all the segment meta-data in the same
header?
Content-Fragment: file-size=3493843; file-ct=video/mpeg;
frag-offset=1200; frag-size=12000;
sth=HHHHHHHHHHHHH aaaaaaaaaaaaa bbbbbbbbbbbbbbb ccccccccccccc
ddddddddddddd eeeeeeeeeee fffffffffffff gggggggggggggg
hhhhhhhhh;
But the large amount of check data might make the overall size of the
header an issue. Or maybe we can ignore than in this MIME context.
> but Jeremy made me realise that in the absence of a Message-ID
> convention, the client needs to do XHDR Content-SHA1-Tree to identify
> the parts, which will give him a lot more data than he really needs if
> he only wants a few files. a separate header for the root hash might
> be a good idea for that reason.
I think we should use the Message-ID convention on Usenet to solve that
problem. That is why I created the Message-ID convention in the first
place - to solve that very problem.
> hey! I believe Content-Disposition is "doing it right". well,
> actually, I would prefer message/fragment, but that requires more work
> to get accepted in MIME, and it also has less applicability for
> non-MIME messages.
I haven't studied MIME enough to offer a good guess at what would be the
"best" way to fit it in. Since we are talking about a major new concept
(file segements) being added after-the-fact, it's likely that the best
solution will require doing something "unnatural".
> > [...] where leading "zeros" (which is actually A in the MIME
> > base64 alphabet) [...]
>
> yeah, isn't that annoying? I wonder what the rationale for that was.
I'm sure it happened just by accident. It probably wasn't thought about in
the context of encoding base-64 numbers. It was just for encoding "8 bit
data" in a base-64 system. Someone probably suggested the characters A-Z,
a-z, 0-9, and + and /, (in that order), so that became the order for the
alphabet.
> > I'm thinking something like 32K blocks
> > would be better. But is making things worse for uuencode now
> > going to prevent us from every getting to the point where we would
> > want to build this xBin file system in the future? Maybe.
>
> we still don't know of any uudecode implementations which has a
> problem with short lines ...
Yeah, we could do some testing of the major tools to answer that.
But the other thing I realized was this is only an issue for multipart
uuencode posts. Single part uuencoded posts don't have any interaction
issues with the hash block size. And for multipart posts, it's getting
harder and harder to justify using anything other than yEnc. And when yEnc
is used, there are no hash block size issues. We can use any size and it
works fine with yEnc.
> > I think we are getting closer. The signature header is starting
> > to feel like it fits in MIME to me now.
>
> glad to hear it :)
>
> > Ok, but Content-Disposition just seems the wrong place to put this
> > data (it has nothing to do with display issues) which seems to me
> > belongs more in something like Content-Type. Has MIME used
> > Content-Disposition for any thing else like this which really
> > belongs in Conetent-Type?
>
> I don't think fragment information is more inappropriate for
> Content-Disposition than the filename.
I think the "real" file name is the name= paramater in the Content-Type:
header.
The filename= paramater in the Content-Disposition is the name used for the
"dispaly". I'm guessing. That would explain why it's there. Though I
don't really understand the difference in the two. Maybe it's like the DOS
8.3 name vs the DOS extended length name???
> > Something like:
> >
> > Content-Type: fragment/image/jpg; segment-offset=XXXX
> > segment-size=YYY
>
> that breaks too much with current practice, I think. there's also the
> problem that keywords aren't passed reliably to the helper
> application.
Maybe the all-in-one Content-Fragment: idea above would work?
--
Curt Welch http://CurtWelch.Com/
curt@kcwc.com Webmaster for http://NewsReader.Com/
Re: Content-SHA1-Tree
Author: Lykas
Date: Wed, 05 Feb 2003 13:48
Date: Wed, 05 Feb 2003 13:48
32 lines
1919 bytes
1919 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote in message news:<1r3co0fjr2.fsf@vingodur.ifi.uio.no>...
> [snip]
> Content-SHA1-Tree is a header which is used to verify the correct
> transfer of a file. It differs from most other hashes in that it can
> verify individual fragments of a file, with only the information
> included in this header and the fragment itself.
>
I have sought about an other scheme with a similar purpose. I don't
know if it is secure enough (or secure at all). Any comments would
be appreciated.
f_1, f_2, ..., f_n a set of files,
H a hash function, ^ the xor operator
id_1 = H(f_1), id_2 = H(f_2), ..., id_n = H(f_n),
id = id_1^id_2^...^id_n,
id'_1 = id_2^id_3^...^id_n,
id'_2 = id_1^id_3^...^id_n,
...,
id'_n = id_1^id_2^...^id_{n-1}.
now when you send (f_i,id'_i), the receifer can verify that f_i
belongs to the set "id" when H(f_i)^id'_i = id.
> [snip]
> The size of a block must be constant across implementations. The
> chosen value is 22500 octets.
What is the reason for this value?
Re: Content-SHA1-Tree
Author: Lykas
Date: Wed, 05 Feb 2003 14:32
Date: Wed, 05 Feb 2003 14:32
4 lines
974 bytes
974 bytes
in my other post xor would of course have to be replaced with a commutative hash function to make it at least minimally secure.
Re: Content-SHA1-Tree
Author: Rene
Date: Thu, 06 Feb 2003 21:21
Date: Thu, 06 Feb 2003 21:21
38 lines
2324 bytes
2324 bytes
lykas@gmx.ch (Lykas) wrote:
> in my other post xor would of course have to be replaced
> with a commutative hash function to make it at least
> minimally secure.
I was just going to tell you how to break your initial suggestion. However
I don't see right at the spot how your scheme would be supposed to work
now.
In your original proposal:
id_1 = H(f_1), id_2 = H(f_2), ..., id_n = H(f_n),
id = id_1^id_2^...^id_n,
id'_1 = id_2^id_3^...^id_n,
id'_2 = id_1^id_3^...^id_n,
...,
id'_n = id_1^id_2^...^id_{n-1}.
I just need to download one correct set, get the id by calcualting the hash
of that file H(f_i) and (xor-)adding it to id'_i. Then I can make a bogus
file, calculate the hash of that and xor that with id to get a valid
looking my id'_i.
You've seen that this is highly insecure. But how are you going to replace
the xor operation with a hash exactly so that any file can be verified
independently? I don't see that right now. Hashing instead of xor'ing the
IDs wont work, because when I have f_3, I only have the already hashed
string id'_3 and not all the other id's. But I would need those to verify
f_3.
And if you make the hash operation reversible (that's almost a paradoxon),
then it is just as insecure as using xor in the first place.
Maybe I'm just not seeing the obvious, I had a hard day.
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
Re: Content-SHA1-Tree
Author: Lykas
Date: Fri, 07 Feb 2003 09:59
Date: Fri, 07 Feb 2003 09:59
21 lines
1966 bytes
1966 bytes
Rene <invalid@email.addr> wrote in message news:<20030206162151.355$h5@newsreader.com>... > lykas@gmx.ch (Lykas) wrote: > You've seen that this is highly insecure. But how are you going to replace > the xor operation with a hash exactly so that any file can be verified > independently? I don't see that right now. Hashing instead of xor'ing the > IDs wont work, because when I have f_3, I only have the already hashed > string id'_3 and not all the other id's. But I would need those to verify > f_3. > > And if you make the hash operation reversible (that's almost a paradoxon), > then it is just as insecure as using xor in the first place. > > Maybe I'm just not seeing the obvious, I had a hard day. It would require a commutative, associative one way function (aowf), i.e you could use them the same way as an xor but it wuold be hard to invert even when one argument is known. Problem: I don't think there is a standard implementation of a aowf. So a Merkle hash tree is the better solution.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads