Subject: [smime] eContentType for detached signatures

From: Paul Hoffman <[email-masked]>
Date: Wed, 30 Apr 2014 09:25:36 -0700

Greetings again. An issue has come forth that significantly affects S/MIME, specifically detached signatures. It would be good if this group (which hasn't been a WG in four years) could weigh in on the topic.

RFC 5485 describes how to use S/MIME detached signatures to sign Internet Drafts. That RFC was not produced by this group, and was barely discussed here at all. (There was a two-day discussion under the subject of "Please review draft-housley-internet-draft-sig-file-00.txt"). That RFC makes a significant change to detached signatures in that it make the eContentType define the type of document that is being signed, and names four content types, none of which are formally defined. If you look at the table labeled "SMI Security for S/MIME CMS Content Type (1.2.840.113549.1.9.16.1)" in http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-26, you see that those four types are the only non-security types in the table. 

The rationale at the time for this design choice was approximately "a detached signature over a file that has no MIME information needs to specify the content type of the file". The files being signed in RFC 5485 don't have any MIME information, so RFC 5485 created CMS content types for them.

Note that any file can have detached signatures, not just the four types of files named in RFC 5485. RFC 3852, our standard, talks a bit about detached signatures:

   The optional omission of the eContent within the
   EncapsulatedContentInfo field makes it possible to construct
   "external signatures."  In the case of external signatures, the
   content being signed is absent from the EncapsulatedContentInfo value
   included in the signed-data content type.  If the eContent value
   within EncapsulatedContentInfo is absent, then the signatureValue is
   calculated and the eContentType is assigned as though the eContent
   value was present.

Nothing there says to me that the eContentType should be usable by a receiving party to know what the inner content type is. There was no concept of that in any of the three versions of the CMS standard.

To me, RFC 5485 took the wrong path. It should not be required that every time someone wants to create a detached signature over a file, they need to register a new CMS content type. Instead, there should be one eContentType for detached signatures that is defined as "inner content type is undefined". An alternative would be to create OIDs for everything in the MIME registry, but this seems excessive and of little value.

Thoughts appreciated.

--Paul Hoffman

---

From: "Jim Schaad" <[email-masked]>
Date: Wed, 30 Apr 2014 10:15:16 -0700

Oh God No.

It has been my contention for a long time that the S/MIME group made a
mistake by not defining a new content type for S/MIME messages which was
id-ct-mime to allow for a processor to know that there was mime content
inside rather than some unknown binary or text object (which happened to not
be ASN.1). 

What RFC 5485 did makes perfect sense to me and always has.  I completely
disagree that there is any indication that the econtentType does not give an
indication of what the inner content is, that is the complete purpose of the
field.  The definition of eContentType is

eContentType is an object identifier.  The object identifier uniquely
specifies the content type.

It does not say that this is how to know how to decode it - it says is
uniquely specifies the content.  (And probably really should say content not
content type.)  There is nothing here that says it needs to be an ASN.1
content for new OID values.

One needs only to define a new content type for those things which need
special handling before they are processed.  This is true for some contents
defined in RFC 5485 (asciiTextWithCRLF and xml).  It may be convenient to do
this for contents that are different and have no easy internal
identification (this is true for the pdf and postscript types defined in RFC
5485).  For mime, one would need, at most, to define one which would be
id-mime to say that mime is embedded.  If one wanted to directly include the
content, without the mime wrapping, then yes, one could defined a new CMS
content type for that purpose.  I think one would probably get pushback from
the expert reviewers in this case (I know that I would) unless there
appeared to be a good reason for dropping the mime wrapping.

Jim

-----Original Message-----
From: smime [mailto:[email-masked]] On Behalf Of Paul Hoffman
Sent: Wednesday, April 30, 2014 9:26 AM
To: [email-masked]
Subject: [smime] eContentType for detached signatures

Greetings again. An issue has come forth that significantly affects S/MIME,
specifically detached signatures. It would be good if this group (which
hasn't been a WG in four years) could weigh in on the topic.

RFC 5485 describes how to use S/MIME detached signatures to sign Internet
Drafts. That RFC was not produced by this group, and was barely discussed
here at all. (There was a two-day discussion under the subject of "Please
review draft-housley-internet-draft-sig-file-00.txt"). That RFC makes a
significant change to detached signatures in that it make the eContentType
define the type of document that is being signed, and names four content
types, none of which are formally defined. If you look at the table labeled
"SMI Security for S/MIME CMS Content Type (1.2.840.113549.1.9.16.1)" in
http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-26
, you see that those four types are the only non-security types in the
table. 

The rationale at the time for this design choice was approximately "a
detached signature over a file that has no MIME information needs to specify
the content type of the file". The files being signed in RFC 5485 don't have
any MIME information, so RFC 5485 created CMS content types for them.

Note that any file can have detached signatures, not just the four types of
files named in RFC 5485. RFC 3852, our standard, talks a bit about detached
signatures:

Nothing there says to me that the eContentType should be usable by a
receiving party to know what the inner content type is. There was no concept
of that in any of the three versions of the CMS standard.

To me, RFC 5485 took the wrong path. It should not be required that every
time someone wants to create a detached signature over a file, they need to
register a new CMS content type. Instead, there should be one eContentType
for detached signatures that is defined as "inner content type is
undefined". An alternative would be to create OIDs for everything in the
MIME registry, but this seems excessive and of little value.

Thoughts appreciated.

--Paul Hoffman
_______________________________________________
smime mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/smime

---

From: Paul Hoffman <[email-masked]>
Date: Wed, 30 Apr 2014 10:38:03 -0700

> Oh God No.

Tell us what you really think, Jim. :-)

> inside rather than some unknown binary or text object (which happened to not

That suggestion would be fine; it is also unrelated to the current topic. We are talking about detached signatures on things that are not MIME-wrapped objects.

> content for new OID values.

My proposal meets that definition. It specifies that the inner content type is not specified.

> defined in RFC 5485 (asciiTextWithCRLF and xml).  

I'm not seeing what is the "special handling" needed for the detached signatures defined in RF 5485. That may be were we diverge so severely.

When you are validating a detached signature, what is the special handling needed?

> It may be convenient to do

Again, this thread has nothing to do with MIME-wrapped content.

--Paul Hoffman

---

From: "Jim Schaad" <[email-masked]>
Date: Wed, 30 Apr 2014 12:19:27 -0700

-----Original Message-----
From: Paul Hoffman [mailto:[email-masked]] 
Sent: Wednesday, April 30, 2014 10:38 AM
To: Jim Schaad
Cc: [email-masked]
Subject: Re: [smime] eContentType for detached signatures

> mistake by not defining a new content type for S/MIME messages which 
> was id-ct-mime to allow for a processor to know that there was mime 
> content inside rather than some unknown binary or text object (which 
> happened to not be ASN.1).

That suggestion would be fine; it is also unrelated to the current topic. We
are talking about detached signatures on things that are not MIME-wrapped
objects.

[JLS] It shows that I have thought that the inner content type is not
restricted to being an identifier of an ASN.1 encoding object for so time.
I don't distinguish between having signatures on detached objects and having
signatures on embedded objects as they can be mechanically transformed
between each other.  Remember that S/MIME messages come in both forms -
embedded and detached.

> What RFC 5485 did makes perfect sense to me and always has.  I 
> completely disagree that there is any indication that the econtentType 
> does not give an indication of what the inner content is, that is the 
> complete purpose of the field.  The definition of eContentType is
> 
> uniquely specifies the content.  (And probably really should say 
> content not content type.)  There is nothing here that says it needs 
> to be an ASN.1 content for new OID values.

My proposal meets that definition. It specifies that the inner content type
is not specified.

[JLS] And with your proposal it does not say that you will have any idea of
either what the content is or how to decode it.  Note that with detached
content the fact that one may need to canonicalize the content before
hashing is a fact of life.  Please tell me that text files have the same
CRLF handing on all systems and this will go away.  If you cannot
distinguish between text and binary files (which may also contain CRLF and
LF sequences) then it becomes important.

> One needs only to define a new content type for those things which 
> need special handling before they are processed.  This is true for 
> some contents defined in RFC 5485 (asciiTextWithCRLF and xml).

I'm not seeing what is the "special handling" needed for the detached
signatures defined in RF 5 485. That may be were we diverge so severely.

When you are validating a detached signature, what is the special handling
needed?

[JLS] Read sections 2.2 and 2.3 which both specify that there is
canonicalization that is to be performed on the detached content prior to
computing the hash.

> identification (this is true for the pdf and postscript types defined 
> in RFC 5485).  For mime, one would need, at most, to define one which 
> would be id-mime to say that mime is embedded.  If one wanted to 
> directly include the content, without the mime wrapping, then yes, one 
> could defined a new CMS content type for that purpose.  I think one 
> would probably get pushback from the expert reviewers in this case (I 
> know that I would) unless there appeared to be a good reason for dropping
the mime wrapping.

[JLS] This was a response to your comment in the message that  ". An
alternative would be to create OIDs for 
everything in the MIME registry, but this seems excessive and of little
value."  I was saying that this is not necessary for all cases but might be
needed if special processing is required.

Jim

--Paul Hoffman=

---

From: Paul Hoffman <[email-masked]>
Date: Wed, 30 Apr 2014 16:25:19 -0700

We agree that having a id-ct-mime would be a good thing. We also seem to agree that id-ct-asciiTextWithCRLF signals that the content must be be processed with the exact canonicalization specified in RFC 5485 before signing and validation. I was wrong when I said that I didn't see the need for the type for the content type you are focused on; I was actually looking at the other two types that were defined in RFC 5485, id-ct-xml and id-ct-pdf, which do not use the canonicalization rules given in the RFC. It was from there that I worry that this indicates that all types, not only those that need canonicalization, need to be defined, given that we have no definition for any.

This thread was prompted by Russ asking that, when Internet Drafts and RFCs no longer are expected to be all-ASCII, do we need another CMS content type. To me, this means making up a new canonicalization form for these, but we will also need to make one up for all the for other types that might be published. Further, it pointed out to me that the canonicalization that is defined in RFC 5485 is already fragile. It doesn't apply to two of the types defined in that RFC, and it makes a false assumption that all inputs are really ASCII (sometimes, non-ASCII characters slip through).

So, I still question whether or not RFC 5485 did the right thing in defining id-ct-xml and id-ct-pdf, and particularly in not defining something that could be called id-ct-unknown.

--Paul Hoffman