Re: [smime] PKCS#7 v1.5 vs. CMS / ContentInfo vs. EncapsulatedContentInfo based on version

Jim Schaad <> Fri, 03 November 2017 18:25 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id DACC413FF19 for <>; Fri, 3 Nov 2017 11:25:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id oknLBR3LgdiK for <>; Fri, 3 Nov 2017 11:25:29 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 539EF13FD49 for <>; Fri, 3 Nov 2017 11:25:28 -0700 (PDT)
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Language: en-us
DKIM-Signature: v=1; a=rsa-sha256;; s=winery; c=simple/simple; t=1509733526; h=from:subject:to:date:message-id; bh=rTh8cGf5OZ/GqInR0Nz4j0tj3kvqqiSz2lct+PwoMXw=; b=BS/CksscIaLKBrJ6lf4QO7BzFm6nconzuoVWMRJlQfkPl9OpJHLoliFjFWlLNwZH+uugysxStbL zVymdZaDdlWlo/34VsQ7w/xRT/gMmaoqwLSEJYvf2ykrgsLCsGocBTNeyxGpA8Sjbv345MTY4Fq7d jc+K3VbH3TILPVcDWa28mHuds6KyVV+ECbUp6Puosi4aOT5fRNDZcMEV9OWyLVj2rYWRTNBOHCIhw 3riGsLoWYhSdrQNOhB0ZqGe7cH9ESwXskQ2RYL7x+HD8jvkJo81A6gjTuER+i/7FM9X5PzV9gJk5q SF8sz76T3wslWj9B9VAdSuVSGluRoTNNhkyQ==
Received: from ( by ( with Microsoft SMTP Server (TLS) id 15.0.1263.5; Fri, 3 Nov 2017 11:25:26 -0700
Received: from Hebrews ( by ( with Microsoft SMTP Server (TLS) id 15.0.1263.5; Fri, 3 Nov 2017 11:24:22 -0700
From: Jim Schaad <>
To: <>, <>
References: <>
In-Reply-To: <>
Date: Fri, 3 Nov 2017 11:25:20 -0700
Message-ID: <001101d354d1$1cfdced0$56f96c70$>
MIME-Version: 1.0
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQKF3Wi9cvbMmmnh/4p3vrg5y3Oj2aGd5PeQ
X-Originating-IP: []
Archived-At: <>
Subject: Re: [smime] PKCS#7 v1.5 vs. CMS / ContentInfo vs. EncapsulatedContentInfo based on version
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: SMIME Working Group <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Fri, 03 Nov 2017 18:25:31 -0000

There was never any intent that a version number of one would indicate that
this was PKCS#7 rather than CMS.

To begin with, this is only a problem if you are looking at wrapping
contents other than id-data, for id-data there is no difference.  In both
cases there is an OCTET wrapper.

For things which are not id-data, there is going to be a difference between
the two encodings in that for one an octet wrapper is there and for the
other case it is not.  I would say that you need to look at the content type
and the type of the field and then make a decision about what you are doing.
I will note that there is a security problem with the PKCS#7 encoding where
the content and length bytes are not correctly protected.  This is one of
the reasons that CMS added the OCTET wrapper in all cases rather than just
in the case of id-data.  


> -----Original Message-----
> From: smime [] On Behalf Of Martin Rex
> Sent: Friday, November 3, 2017 9:05 AM
> To:
> Subject: [smime] PKCS#7 v1.5 vs. CMS / ContentInfo vs.
> EncapsulatedContentInfo based on version
> There is a somewhat confusing ruleset around the "SignedData" PDU version
> field in the CMS specification, and insufficient guidance about the
> for the Encoder/Decoder for ContentInfo when version 1 vs. 3 is chosen.
> The organization responsible for certain legally mandated data exchanges
> Germany is rev'ving their requirements, intoducing RSA-PSS signatures on
> certificates plus RSA-OAEP encryption for AppData.
> Previously, they've been using PKCS#7 v1.5 PDUs with RSA PKCS#1 v1.5
> transforms.
> The confusion I'm seeing is about the choice of the SignedData "version"
> field, and the resulting consequences for the (ASN.1) PDU encoder/decoder
> the ContentInfo vs. EncapsulatedContentInfo in SignedData.
> For the encoder/decoder, the reasonable interpretation would be, that
> whenever version=1, then the PKCS#7 ContentInfo encoding will be used, and
> only for version>=3, the CMS EncapsulatedContentInfo encoding will be
> encoded or decoded.
> However the current reading of the CMS standard by that organization is
> they want to specify version=1 in combination with EncapsulatedContentInfo
> encoding -- something that looks extremely weird to me, and would require
> significant contortions in the ASN.1 encoder and decoder.
> For the encoder, it will require a laying violation from within the
> looking at later elements and semantics of higher level PDUs.
> For the decoder, it essentially will require heuristics (trial-and-error)
> if the PDU version will no longer matter, and the data determining which
> encoding is appropriate, has not been decoded yet at this point requiring
> retroactive verification of whether the heuristically determined encoding
> actually a _valid_ encoding.
> Any comments from folks more experienced with CMS ?
> -Martin
> _______________________________________________
> smime mailing list